Documentation
¶
Index ¶
Constants ¶
const ( JitterFull = "full" JitterNone = "none" )
The jitter vocabulary, spelled the way the spec spells it. An empty field means full jitter, which is the default the project chose: retries without spread synchronise into a thundering herd against whatever just stumbled.
Variables ¶
This section is empty.
Functions ¶
func Delay ¶
Delay returns how long to wait before the attempt after the one that just failed. Attempt is 1-based and names the attempt that failed; values below one count as the first. Rnd is the injected source of randomness; it must be non-nil unless the policy's jitter is none, and the same seed always replays the same draws.
The function is pure: no clock, no globals, no state. Monotonic in the attempt until the cap, never above MaxDelay, never negative, and free of overflow for any attempt number, because growth stops at the cap instead of doubling past it. Durations this side of 292 years are safe.