From 3dc3fc8e5ac2eb2095ae8eb0cf1370651ea25d71 Mon Sep 17 00:00:00 2001 From: Ivan FB <128452529+Ivansete-status@users.noreply.github.com> Date: Tue, 22 Oct 2024 20:09:25 +0200 Subject: [PATCH] peer_manager: prevent too intense loop when no peers connected (#3130) --- waku/node/peer_manager/peer_manager.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/waku/node/peer_manager/peer_manager.nim b/waku/node/peer_manager/peer_manager.nim index cb728f3ee..cf633bb13 100644 --- a/waku/node/peer_manager/peer_manager.nim +++ b/waku/node/peer_manager/peer_manager.nim @@ -928,7 +928,7 @@ proc relayConnectivityLoop*(pm: PeerManager) {.async.} = chronos.seconds(int(float(ConnectivityLoopInterval.seconds()) * factor)) # Shorten the connectivity loop interval dynamically based on percentage of peers to fill or connections to prune - await sleepAsync(dynamicSleepInterval) + await sleepAsync(max(dynamicSleepInterval, chronos.seconds(1))) proc pruneInRelayConns(pm: PeerManager, amount: int) {.async.} = if amount <= 0: