From 46536eccc4d284f8cd176eab0c2bc0785ec32338 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 10 Aug 2020 14:26:15 +0300 Subject: [PATCH] fix backoff slack time --- gossipsub.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gossipsub.go b/gossipsub.go index 7ebdacd..247fda9 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -1497,10 +1497,11 @@ func (gs *GossipSubRouter) clearBackoff() { return } - now := time.Now().Add(2 * GossipSubHeartbeatInterval) + now := time.Now() for topic, backoff := range gs.backoff { for p, expire := range backoff { - if expire.Before(now) { + // add some slack time to the expiration + if expire.Add(2 * GossipSubHeartbeatInterval).Before(now) { delete(backoff, p) } }