Documentation
¶
Overview ¶
Package backoff provides retry backoff strategies for the outbox relay.
Index ¶
Constants ¶
const Stop = time.Duration(-1)
Stop is the sentinel a NextBackOff-style source returns to mean "no more retries"; it matches github.com/cenkalti/backoff.Stop. Adapters map it to 0.
Variables ¶
var Default = Exp(100*time.Millisecond, 30*time.Second, true)
Default is exponential 100ms -> 30s with full jitter.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
Backoff returns the delay before the retry that follows the given attempt number. attempt is 1-based: the delay after the first failed attempt is Backoff(1).
func Exp ¶
Exp returns an exponential backoff: base doubled each attempt, capped at maxDelay (0 = no cap). With jitter the result is uniform in [0, computed].
func FromNextBackOff ¶
func FromNextBackOff(newB func() NextBackOffer) Backoff
FromNextBackOff adapts a cenkalti/backoff-style source to a Backoff. newB must return a fresh instance on each call; it is advanced `attempt` times to obtain that attempt's delay. A Stop result yields 0.
ob.WithRetryBackoff(backoff.FromNextBackOff(func() backoff.NextBackOffer {
return cbackoff.NewExponentialBackOff()
}))
func FromNexter ¶
FromNexter adapts a sethvargo/go-retry-style source to a Backoff. newB must return a fresh instance on each call; it is advanced `attempt` times. A stop signal yields 0.
type NextBackOffer ¶
NextBackOffer matches the retry method of github.com/cenkalti/backoff (BackOff.NextBackOff). *backoff.ExponentialBackOff and friends satisfy it.