mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-13 05:10:06 +02:00
server: extract backOffCeiling into bootstrapBackOffCeiling as constant
This commit is contained in:
parent
abe73ca6c1
commit
efab9cb584
10
server.go
10
server.go
@ -1600,7 +1600,6 @@ func (s *server) peerBootstrapper(numTargetPeers uint32,
|
|||||||
//
|
//
|
||||||
// We'll use a 15 second backoff, and double the time every time an
|
// We'll use a 15 second backoff, and double the time every time an
|
||||||
// epoch fails up to a ceiling.
|
// epoch fails up to a ceiling.
|
||||||
const backOffCeiling = time.Minute * 5
|
|
||||||
backOff := time.Second * 15
|
backOff := time.Second * 15
|
||||||
|
|
||||||
// We'll create a new ticker to wake us up every 15 seconds so we can
|
// 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()
|
sampleTicker.Stop()
|
||||||
|
|
||||||
backOff *= 2
|
backOff *= 2
|
||||||
if backOff > backOffCeiling {
|
if backOff > bootstrapBackOffCeiling {
|
||||||
backOff = backOffCeiling
|
backOff = bootstrapBackOffCeiling
|
||||||
}
|
}
|
||||||
|
|
||||||
srvrLog.Debugf("Backing off peer bootstrapper to "+
|
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
|
// initialPeerBootstrap attempts to continuously connect to peers on startup
|
||||||
// until the target number of peers has been reached. This ensures that nodes
|
// until the target number of peers has been reached. This ensures that nodes
|
||||||
// receive an up to date network view as soon as possible.
|
// receive an up to date network view as soon as possible.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user