Documentation
¶
Overview ¶
Package backoff provides exponential backoff with full jitter for retry logic.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// InitialInterval is the base sleep duration before the first retry.
InitialInterval time.Duration
// MaxInterval is the upper bound on the computed sleep duration.
MaxInterval time.Duration
// Multiplier is applied to the interval on each successive attempt.
// A value of 2.0 doubles the interval each time.
Multiplier float64
// RandomFactor is the fraction of the interval added as jitter.
// 0.0 = no jitter, 1.0 = up to ±100% jitter (full jitter).
RandomFactor float64
}
Config holds parameters for exponential backoff with optional jitter.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a backoff configuration suitable for most use cases. 100ms initial, 30s max, 2x multiplier, 50% jitter.
Click to show internal directories.
Click to hide internal directories.