6 WithMaxRetries creates a wrapper around another BackOff, which will
7 return Stop if NextBackOff() has been called too many times since
8 the last time Reset() was called
10 Note: Implementation is not thread-safe.
12 func WithMaxRetries(b BackOff, max uint64) BackOff {
13 return &backOffTries{delegate: b, maxTries: max}
16 type backOffTries struct {
22 func (b *backOffTries) NextBackOff() time.Duration {
24 if b.maxTries <= b.numTries {
29 return b.delegate.NextBackOff()
32 func (b *backOffTries) Reset() {