MCPcopy
hub / github.com/duke-git/lancet / exponentialWithJitter

Struct exponentialWithJitter

retry/retry.go:173–177  ·  view source on GitHub ↗

exponentialWithJitter is a struct that implements the BackoffStrategy interface using a exponential backoff strategy.

Source from the content-addressed store, hash-verified

171
172// exponentialWithJitter is a struct that implements the BackoffStrategy interface using a exponential backoff strategy.
173type exponentialWithJitter struct {
174 base time.Duration // base is the multiplier for the exponential backoff.
175 interval time.Duration // interval is the current backoff interval, which will be adjusted over time.
176 maxJitter time.Duration // maxJitter is the maximum amount of jitter to apply to the backoff interval.
177}
178
179// CalculateInterval calculates the next backoff interval with jitter and updates the interval.
180func (e *exponentialWithJitter) CalculateInterval() time.Duration {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected