peer_manager: prevent too intense loop when no peers connected (#3130)

This commit is contained in:
Ivan FB 2024-10-22 20:09:25 +02:00 committed by GitHub
parent 889067ba20
commit 3dc3fc8e5a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -928,7 +928,7 @@ proc relayConnectivityLoop*(pm: PeerManager) {.async.} =
chronos.seconds(int(float(ConnectivityLoopInterval.seconds()) * factor)) chronos.seconds(int(float(ConnectivityLoopInterval.seconds()) * factor))
# Shorten the connectivity loop interval dynamically based on percentage of peers to fill or connections to prune # 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.} = proc pruneInRelayConns(pm: PeerManager, amount: int) {.async.} =
if amount <= 0: if amount <= 0: