unistore: add timeout config for resource server joining the ring (#112392)

Signed-off-by: Maicon Costa <maiconscosta@gmail.com>
This commit is contained in:
maicon
2025-10-14 15:27:08 -04:00
committed by GitHub
parent 507720e601
commit 3d112755de
4 changed files with 8 additions and 1 deletions
@@ -314,6 +314,11 @@ func createStorageServerApi(t *testing.T, instanceId int, dbType, dbConnStr stri
cfg.IndexPath = t.TempDir() + cfg.InstanceID
cfg.IndexFileThreshold = testIndexFileThreshold
cfg.Target = []string{modules.StorageServer}
// make sure the resource server has enough time to join the ring
// before the tests start sending traffic
// otherwise the tests will be flaky,
// also, tests are going to timeout after 300 seconds anyway
cfg.ResourceServerJoinRingTimeout = 300 * time.Second
return initModuleServerForTest(t, cfg, Options{}, api.ServerOptions{})
}
+1
View File
@@ -601,6 +601,7 @@ type Cfg struct {
SprinklesApiServerPageLimit int
CACertPath string
HttpsSkipVerify bool
ResourceServerJoinRingTimeout time.Duration
// Secrets Management
SecretsManagement SecretsManagerSettings
+1
View File
@@ -77,6 +77,7 @@ func (cfg *Cfg) setUnifiedStorageConfig() {
cfg.SprinklesApiServerPageLimit = section.Key("sprinkles_api_server_page_limit").MustInt(10000)
cfg.CACertPath = section.Key("ca_cert_path").String()
cfg.HttpsSkipVerify = section.Key("https_skip_verify").MustBool(false)
cfg.ResourceServerJoinRingTimeout = section.Key("resource_server_join_ring_timeout").MustDuration(10 * time.Second)
cfg.MaxFileIndexAge = section.Key("max_file_index_age").MustDuration(0)
cfg.MinFileIndexBuildVersion = section.Key("min_file_index_build_version").MustString("")
+1 -1
View File
@@ -310,7 +310,7 @@ func (s *service) starting(ctx context.Context) error {
if s.cfg.EnableSharding {
s.log.Info("waiting until resource server is JOINING in the ring")
lfcCtx, cancel := context.WithTimeout(context.Background(), time.Second*10)
lfcCtx, cancel := context.WithTimeout(context.Background(), s.cfg.ResourceServerJoinRingTimeout)
defer cancel()
if err := ring.WaitInstanceState(lfcCtx, s.searchRing, s.ringLifecycler.GetInstanceID(), ring.JOINING); err != nil {
return fmt.Errorf("error switching to JOINING in the ring: %s", err)