Source File
tries.go
Belonging Package
github.com/cenkalti/backoff/v4
package backoffimport/*WithMaxRetries creates a wrapper around another BackOff, which willreturn Stop if NextBackOff() has been called too many times sincethe last time Reset() was calledNote: Implementation is not thread-safe.*/func ( BackOff, uint64) BackOff {return &backOffTries{delegate: , maxTries: }}type backOffTries struct {delegate BackOffmaxTries uint64numTries uint64}func ( *backOffTries) () time.Duration {if .maxTries == 0 {return Stop}if .maxTries > 0 {if .maxTries <= .numTries {return Stop}.numTries++}return .delegate.NextBackOff()}func ( *backOffTries) () {.numTries = 0.delegate.Reset()}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |