Documentation ¶
Overview ¶
Package backoff provides a back-off timer type.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct { // NewTimer is the function that acts like time.NewTimer. // It's for use in unit tests. NewTimer func(time.Duration) *time.Timer // LogLongerThan sets the minimum time of a single backoff interval // before we mention it in the log. LogLongerThan time.Duration // contains filtered or unexported fields }
Backoff tracks state the history of consecutive failures and sleeps an increasing amount of time, up to a provided limit.
func NewBackoff ¶
NewBackoff returns a new Backoff timer with the provided name (for logging), logger, and max backoff time. By default, all failures (calls to BackOff with a non-nil err) are logged unless the returned Backoff.LogLongerThan is adjusted.
Click to show internal directories.
Click to hide internal directories.