From af24051bf5897839ebdf2061230ea7bf17358379 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Mon, 24 Oct 2022 14:34:48 +0300 Subject: [PATCH] network: sleep a bit before retrying reconnects If Dial() is to exit quickly we can end up in a retry loop eating CPU. --- pkg/network/discovery.go | 1 + 1 file changed, 1 insertion(+) diff --git a/pkg/network/discovery.go b/pkg/network/discovery.go index cb4e32555..2e762806c 100644 --- a/pkg/network/discovery.go +++ b/pkg/network/discovery.go @@ -261,6 +261,7 @@ func (d *DefaultDiscovery) tryAddress(addr string) { d.lock.Unlock() if err != nil { d.RegisterBadAddr(addr) + time.Sleep(d.dialTimeout) d.RequestRemote(1) } }