Skip to content

Commit 6105e71

Browse files
committed
adds delay to sync cluster nodes
1 parent 81c5803 commit 6105e71

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

controller/cluster.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func (c *ClusterChecker) syncClusterToNodes(ctx context.Context) error {
255255
}
256256
version := clusterInfo.Version.Load()
257257
operationCount := 0
258-
staggerDelay := 1000 * time.Millisecond
258+
staggerDelay := 5000 * time.Millisecond
259259
for _, shard := range clusterInfo.Shards {
260260
for _, node := range shard.Nodes {
261261
go func(n store.Node, delay time.Duration) {
@@ -285,10 +285,13 @@ func (c *ClusterChecker) parallelProbeNodes(ctx context.Context, cluster *store.
285285
var latestClusterNodesStr string
286286
var wg sync.WaitGroup
287287

288+
operationCount := 0
289+
staggerDelay := 5000 * time.Millisecond
288290
for i, shard := range cluster.Shards {
289291
for _, node := range shard.Nodes {
290292
wg.Add(1)
291-
go func(shardIdx int, n store.Node) {
293+
go func(shardIdx int, n store.Node, delay time.Duration) {
294+
time.Sleep(delay)
292295
defer wg.Done()
293296
log := logger.Get().With(
294297
zap.String("id", n.ID()),
@@ -336,7 +339,8 @@ func (c *ClusterChecker) parallelProbeNodes(ctx context.Context, cluster *store.
336339
mu.Unlock()
337340
}
338341
c.resetFailureCount(n.ID())
339-
}(i, node)
342+
}(i, node, time.Duration(operationCount)*staggerDelay)
343+
operationCount++
340344
}
341345
}
342346

0 commit comments

Comments
 (0)