From 908f07d1dcb177ca232ff8d8ead152197366b81b Mon Sep 17 00:00:00 2001 From: aviv Date: Sun, 17 Dec 2023 12:57:34 +0200 Subject: [PATCH] RavenDB-20122 : UpdateTopologyChangeNotification - use reconnection backoff if cluster has no leader, in order to avoid high cpu when watcher is waiting for leader to come up --- src/Raven.Server/ServerWide/ServerStore.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Raven.Server/ServerWide/ServerStore.cs b/src/Raven.Server/ServerWide/ServerStore.cs index 9685c5777d19..660b1ee5c1e9 100644 --- a/src/Raven.Server/ServerWide/ServerStore.cs +++ b/src/Raven.Server/ServerWide/ServerStore.cs @@ -336,7 +336,14 @@ public void UpdateTopologyChangeNotification() { var topology = GetClusterTopology(); var leader = _engine.LeaderTag; - if (leader == null || leader == _engine.Tag) + + if (leader == null) + { + delay = ReconnectionBackoff(delay); + break; + } + + if (leader == _engine.Tag) break; var leaderUrl = topology.GetUrlFromTag(leader);