Documentation
¶
Overview ¶
Package backoff is the saturating exponential used wherever the framework waits and retries. It computes a raw delay only: jitter, zero-value defaults, and per-site reset stay at the caller.
Audit of the three adopters (gaborage/go-bricks#1249):
Site Jitter Reset base <= 0
messaging computeBackoff math/rand/v2 full jitter reconnect resets on success; package default
(#nosec G404 stays at caller) publish-retry is per-operation
httpclient backoffDelay crypto/rand full jitter per-operation package default
(RNG-failure fallback stays)
delivery backoffFor none per-operation 0
The outbox relay idle path (ADR-088) is a later consumer: it waits a fixed poll interval today, not this series. The helper is (base, cap, shift) so that path can adopt it without this package knowing about ledgers or locks.
Index ¶
Constants ¶
const MaxDuration = time.Duration(math.MaxInt64)
MaxDuration is the largest representable backoff. An uncapped series saturates here instead of wrapping past int64.
Variables ¶
This section is empty.
Functions ¶
func Saturating ¶
Saturating returns base shifted shift times, saturating at MaxDuration instead of wrapping. maxDelay > 0 clamps the result; maxDelay <= 0 leaves it uncapped (the delivery policy's optional MaxBackoff).
A non-positive base is 0: callers that want a package default apply it first. A negative shift waits nothing, so a computed exponent cannot wrap through uint and saturate by accident.
Types ¶
This section is empty.