Documentation
¶
Overview ¶
Package retry is the backoff of every execution failure in the lifecycle and the Clock its deadlines are read with.
Index ¶
Constants ¶
const ( Min = time.Second Max = 2 * time.Minute )
Default bounds of a backoff: the delay doubles from Min up to Max. Max is every engine backoff's cap: a package recovers within it after a transient outage.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Backoff ¶
type Backoff struct {
// Initial is the first delay instead of Min when set.
Initial time.Duration
// contains filtered or unexported fields
}
Backoff delays a retry of one failed attempt; any other attempt is not delayed. The key names the attempt (an operation and its Inputs, a configuration): new Inputs or a new configuration are never delayed by the backoff of an older attempt, and a failure of another key starts the delay again from the first delay. The zero value holds nothing and doubles from Min up to Max. Not safe for concurrent use: one loop owns it.
func (*Backoff) Failed ¶
Failed records a failure of key at now and returns until when a retry of key is held. The delay doubles while the same key keeps failing.
func (*Backoff) Holds ¶
Holds reports whether an attempt of key must still wait at now: only the key that failed last, and only before its deadline.
type Clock ¶
Clock is the time the package Reconciler, Current and Global decide and wait with: backoff deadlines, the update window, their wake timers. Tests drive it by hand.