Cap link backoff at roughly 4.5 hours

This commit is contained in:
Neil Alexander 2023-11-21 23:54:27 +00:00
parent abec2256ae
commit a0b3897278
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944

View File

@ -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 // The caller should check the return value to decide whether
// or not to give up trying. // or not to give up trying.
backoffNow := func() bool { backoffNow := func() bool {
if backoff < 14 { // Cap at roughly 4.5 hours maximum.
backoff++ backoff++
}
duration := time.Second * time.Duration(math.Exp2(float64(backoff))) duration := time.Second * time.Duration(math.Exp2(float64(backoff)))
select { select {
case <-state.kick: case <-state.kick: