From c15c8a1f0be7f585387e94fe722d6ed17f357dec Mon Sep 17 00:00:00 2001 From: yyforyongyu Date: Sat, 27 Nov 2021 05:13:23 +0800 Subject: [PATCH] discovery: transit all inactive syncers when needed --- discovery/sync_manager.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discovery/sync_manager.go b/discovery/sync_manager.go index e5edb7744..0535bac4b 100644 --- a/discovery/sync_manager.go +++ b/discovery/sync_manager.go @@ -398,6 +398,13 @@ func (m *SyncManager) syncerHandler() { continue } + // We may not even have enough inactive syncers to be + // transitted. In that case, we will transit all the + // inactive syncers. + if len(m.inactiveSyncers) < numActiveLeft { + numActiveLeft = len(m.inactiveSyncers) + } + log.Debugf("Attempting to transition %v passive "+ "GossipSyncers to active", numActiveLeft)