Version: v1.57.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 1 Imported by: 12




This section is empty.


This section is empty.


This section is empty.


type Backoff

type Backoff interface {
	Duration(attempts uint) time.Duration

Backoff is an algorithm for determining how long to wait after a number of attempts to perform some action. Backoff strategies typically use a random number generator that uses some state for feedback. Instances of backoff are intended to be used in the stack of a single goroutine and must therefore either be referentially independent or lock safe.

type Strategy

type Strategy interface {
	Backoff() Backoff

Strategy is a factory for backoff algorithms. Each backoff instance may capture some state, typically a random number generator. The strategy guarantees that these backoff instances are either referentially independent and lockless or thread safe.

Backoff strategies are useful for configuring retry loops, balancing the need to recover quickly against denial of service as a failure mode.

var None Strategy = &none{}

None is a shorted backoff strategy that will always produce a 0ms duration. This strategy is intended to minimize arbitrary delays during tests or maximize load on a benchmark.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL