mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(flash): config init remote client timeout
with: #1000285575
Signed-off-by: clinx <chenlin1@oppo.com>
(cherry picked from commit e11e67210d)
This commit is contained in:
parent
763517e3c1
commit
a7acee10ec
@ -104,6 +104,7 @@ type ClientConfig struct {
|
||||
ConnectTimeout int64 // ms
|
||||
FirstPacketTimeout int64 // ms
|
||||
FromFuse bool
|
||||
InitClientTime int
|
||||
}
|
||||
|
||||
func NewRemoteCacheClient(config *ClientConfig) (rc *RemoteCacheClient, err error) {
|
||||
@ -149,9 +150,12 @@ func NewRemoteCacheClient(config *ClientConfig) (rc *RemoteCacheClient, err erro
|
||||
}
|
||||
close(changeFromRemote)
|
||||
}()
|
||||
if config.InitClientTime == 0 {
|
||||
config.InitClientTime = 5
|
||||
}
|
||||
select {
|
||||
case <-changeFromRemote:
|
||||
case <-time.After(time.Duration(config.FirstPacketTimeout) * time.Millisecond):
|
||||
case <-time.After(time.Duration(config.InitClientTime) * time.Second):
|
||||
log.LogWarnf("NewRemoteCacheClient: init remote cache timeout for remote client")
|
||||
err = proto.ErrorInitRemoteTimeout
|
||||
}
|
||||
|
||||
@ -87,6 +87,7 @@ func NewBenchmarkTester(dataDir, hddBase, nvmeBase string, verify bool, master s
|
||||
LogDir: "/tmp/cfs",
|
||||
ConnectTimeout: 500,
|
||||
FirstPacketTimeout: 1000,
|
||||
InitClientTime: 1,
|
||||
}
|
||||
tester.cacheStorage, err = remotecache.NewRemoteCacheClient(cfg)
|
||||
if err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user