Documentation
¶
Overview ¶
Package retry computes when a failed or stalled attempt may run again (方案 §15.4): an exponential backoff with a reproducible jitter.
Reproducible means the delay is a pure function of the attempt number and a stable seed (the work item's identifier): the same failure on a restarted scheduler produces the same instant, which is what makes "到期判定在 tick 时 求值" checkable. Randomness would make the plan unreproducible across restarts, so the jitter is derived, not drawn.
Index ¶
Constants ¶
const DefaultBase = 30 * time.Second
DefaultBase is the delay before the second attempt when nothing declares one.
const DefaultMax = time.Hour
DefaultMax caps the delay when nothing declares one (方案 §15.4 退避上限).
const DefaultStallThreshold = 30 * time.Minute
DefaultStallThreshold is how long an attempt may make no progress before the tick treats it as stalled (方案 §15.4) when the policy declares none.
Variables ¶
This section is empty.
Functions ¶
func Delay ¶
Delay is the wait before the given attempt (1 = the first retry, i.e. the second attempt). base and max are the policy's bounds; zero or negative values fall back to the defaults. max is a hard ceiling: a policy may ask for retries sooner than the base (a small backoff_max_seconds is a legitimate "retry quickly"), and the jitter is clamped below it.
Types ¶
This section is empty.