network: sleep a bit before retrying reconnects

If Dial() is to exit quickly we can end up in a retry loop eating CPU.
This commit is contained in:
Roman Khimov 2022-10-24 14:34:48 +03:00
parent a17d9f80a4
commit af24051bf5

View file

@ -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)
}
}