Documentation
¶
Overview ¶
Package backoff provides a simple implementation of exponential backoff.
Index ¶
Constants ¶
View Source
const ( DefaultMinInterval = 100 * time.Millisecond DefaultMaxInterval = 60 * time.Second DefaultMultiplier = 1.5 )
Default values for Backoff.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct {
// MinInterval is the initial interval for the backoff. It is used to set the
// lower bound on the range of intervals returned from [Backoff.Next].
MinInterval time.Duration
// MaxInterval is the maximum interval that should be returned from
// [Backoff.Next].
MaxInterval time.Duration
// Multiplier is the Multiplier used when computing the next interval.
Multiplier float64
// Jitter is used to specify a range of randomness for intervals.
Jitter time.Duration
// contains filtered or unexported fields
}
Backoff is a simple exponential backoff implementation. The zero Backoff is valid and will use default configuration values. It is not thread-safe.
type Ticker ¶
type Ticker struct {
DisableInstantTick bool
// contains filtered or unexported fields
}
A Ticker is like time.Ticker but accepts a Backoff.
Click to show internal directories.
Click to hide internal directories.