Skip to content

Commit

Permalink
Cap link backoff at roughly 4.5 hours
Browse files Browse the repository at this point in the history
  • Loading branch information
neilalexander committed Nov 21, 2023
1 parent abec225 commit a0b3897
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ func (l *links) add(u *url.URL, sintf string, linkType linkType) error {
// The caller should check the return value to decide whether
// or not to give up trying.
backoffNow := func() bool {
backoff++
if backoff < 14 { // Cap at roughly 4.5 hours maximum.
backoff++
}
duration := time.Second * time.Duration(math.Exp2(float64(backoff)))
select {
case <-state.kick:
Expand Down

0 comments on commit a0b3897

Please sign in to comment.