Documentation
¶
Index ¶
Constants ¶
View Source
const ( DefaultBackoffBase = time.Nanosecond MaxBackoff = math.MaxInt64 )
Variables ¶
View Source
var ErrBackoffExhausted = errors.New("retry attempts exhausted")
Functions ¶
This section is empty.
Types ¶
type BackoffProvider ¶
type ExponentialJitterBackoff ¶
type ExponentialJitterBackoff struct { Base time.Duration // Base backoff duration Cap time.Duration // The maximum backoff time generated MaxAttempts int // If set will throw ErrBackoffExhausted if reached JitterSource io.Reader // }
ExponentialJitterBackoff provides an exponentially growing backoff duration with jitter to discourage the thundering herd problem.
BackoffByAttempt will return `random_between(0, min(cap, base * 2 ** attempts))`
This is the "Full Jitter" algorithm described at https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
func (*ExponentialJitterBackoff) BackoffByAttempt ¶
func (provider *ExponentialJitterBackoff) BackoffByAttempt(attempts int) (time.Duration, error)
Click to show internal directories.
Click to hide internal directories.