logtail/backoff: only log backoffs > 2sec

Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
pull/342/head
David Crawshaw 5 years ago
parent 0038223632
commit 2372530964

@ -31,7 +31,9 @@ func (b *Backoff) BackOff(ctx context.Context, err error) {
// Randomize the delay between 0.5-1.5 x msec, in order // Randomize the delay between 0.5-1.5 x msec, in order
// to prevent accidental "thundering herd" problems. // to prevent accidental "thundering herd" problems.
msec = rand.Intn(msec) + msec/2 msec = rand.Intn(msec) + msec/2
if msec >= 2000 {
log.Printf("%s: backoff: %d msec\n", b.Name, msec) log.Printf("%s: backoff: %d msec\n", b.Name, msec)
}
newTimer := b.NewTimer newTimer := b.NewTimer
if newTimer == nil { if newTimer == nil {
newTimer = time.NewTimer newTimer = time.NewTimer

Loading…
Cancel
Save