mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
watchtower/wtclient: only reset iterator once we've exhausted all candidates
Doing so allows us to load balance sessions better amongst all of the tower candidates.
This commit is contained in:
parent
0431701262
commit
0690c8f627
1 changed files with 7 additions and 3 deletions
|
@ -240,9 +240,6 @@ retryWithBackoff:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before attempting a bout of session negotiation, reset the candidate
|
|
||||||
// iterator to ensure the results are fresh.
|
|
||||||
n.cfg.Candidates.Reset()
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-n.quit:
|
case <-n.quit:
|
||||||
|
@ -267,6 +264,13 @@ retryWithBackoff:
|
||||||
log.Debugf("Unable to get new tower candidate, "+
|
log.Debugf("Unable to get new tower candidate, "+
|
||||||
"retrying after %v -- reason: %v", backoff, err)
|
"retrying after %v -- reason: %v", backoff, err)
|
||||||
|
|
||||||
|
// Only reset the iterator once we've exhausted all
|
||||||
|
// candidates. Doing so allows us to load balance
|
||||||
|
// sessions better amongst all of the tower candidates.
|
||||||
|
if err == ErrTowerCandidatesExhausted {
|
||||||
|
n.cfg.Candidates.Reset()
|
||||||
|
}
|
||||||
|
|
||||||
goto retryWithBackoff
|
goto retryWithBackoff
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue