server: extract backOffCeiling into bootstrapBackOffCeiling as constant

This commit is contained in:
Olaoluwa Osuntokun 2019-06-27 18:50:28 -07:00
parent abe73ca6c1
commit efab9cb584
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

View File

@ -1600,7 +1600,6 @@ func (s *server) peerBootstrapper(numTargetPeers uint32,
//
// We'll use a 15 second backoff, and double the time every time an
// epoch fails up to a ceiling.
const backOffCeiling = time.Minute * 5
backOff := time.Second * 15
// We'll create a new ticker to wake us up every 15 seconds so we can
@ -1643,8 +1642,8 @@ func (s *server) peerBootstrapper(numTargetPeers uint32,
sampleTicker.Stop()
backOff *= 2
if backOff > backOffCeiling {
backOff = backOffCeiling
if backOff > bootstrapBackOffCeiling {
backOff = bootstrapBackOffCeiling
}
srvrLog.Debugf("Backing off peer bootstrapper to "+
@ -1713,6 +1712,11 @@ func (s *server) peerBootstrapper(numTargetPeers uint32,
}
}
// bootstrapBackOffCeiling is the maximum amount of time we'll wait between
// failed attempts to locate a set of bootstrap peers. We'll slowly double our
// query back off each time we encounter a failure.
const bootstrapBackOffCeiling = time.Minute * 5
// initialPeerBootstrap attempts to continuously connect to peers on startup
// until the target number of peers has been reached. This ensures that nodes
// receive an up to date network view as soon as possible.