From f2c25c22285fa43a0c861141a38574372ef43a5a Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 10 Aug 2020 13:42:22 +0300 Subject: [PATCH] add slack time to prune backoff clearance --- gossipsub.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gossipsub.go b/gossipsub.go index 0a158b4..33eeeac 100644 --- a/gossipsub.go +++ b/gossipsub.go @@ -118,6 +118,10 @@ var ( // before attempting to re-graft. GossipSubPruneBackoff = time.Minute + // GossipSubPruneBackoffSlack is the slack time after expiry of a backoff and before + // attempting a GRAFT. + GossipSubPruneBackoffSlack = time.Second + // GossipSubConnectors controls the number of active connection attempts for peers obtained through PX. GossipSubConnectors = 8 @@ -1497,7 +1501,7 @@ func (gs *GossipSubRouter) clearBackoff() { return } - now := time.Now() + now := time.Now().Add(GossipSubPruneBackoffSlack) for topic, backoff := range gs.backoff { for p, expire := range backoff { if expire.Before(now) {