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:
clinx 2025-08-18 10:55:51 +08:00 committed by chihe
parent 763517e3c1
commit a7acee10ec
2 changed files with 6 additions and 1 deletions

View File

@ -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
}

View File

@ -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 {