From d087a83a63b6eb30342b350314cf299b1efbed97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caner=20=C3=87=C4=B1dam?= Date: Mon, 19 Jun 2023 22:44:40 +0300 Subject: [PATCH] add warning and explanation to force reload interval --- store/registry.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/store/registry.go b/store/registry.go index 19a2a591..ac8e3187 100644 --- a/store/registry.go +++ b/store/registry.go @@ -26,6 +26,14 @@ var ( const ( keyDefaultChainSetting = "default" minShardCount = 1 + + // This is the force reload interval that helps us ignore the on-chain assignment + // list hash. This helps avoid getting stuck with bad state. + // + // WARNING: This also affects how fast the nodes react to shard ID changes + // because the bot assignment hash may not change for a scanner when + // the scanner list for a bot changes (i.e. when another scanner is unassigned). + assignmentForceReloadInterval = time.Minute * 5 ) type RegistryStore interface { @@ -56,7 +64,8 @@ func (rs *registryStore) GetAgentsIfChanged(scanner string) ([]config.AgentConfi return nil, false, err } - shouldUpdate := rs.lastCompletedVersion != hash.Hash || time.Since(rs.lastUpdate) > 5*time.Minute + shouldUpdate := rs.lastCompletedVersion != hash.Hash || + time.Since(rs.lastUpdate) > assignmentForceReloadInterval if !shouldUpdate { return nil, false, nil }