Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrExceededAttempts is an error that is returned for a task that was run // too many times, without being successful. ErrExceededAttempts = errors.New("maximum attempts exceeded") // ErrExceededTime is an error that is returned for a task that ran too // long, without being successful. ErrExceededTime = errors.New("maximum time exceeded") )
Functions ¶
Types ¶
type Spec ¶
type Spec struct { // Attempts is the maximum number of total times a task is run. A value of // zero removes this restriction, and a task will be run indefinitely. Attempts int // Backoff is for enabling exponential backoff between task invocations. // The time between tasks will double each time there is a failure, but // will reset if there is a subsequent success. Backoff bool // Consecutive is the number of successful task runs that must happen in a // row in order for the task to be considered successful overall. Consecutive int // InitialDelay is the duration to pause before initially starting task // invocations. InitialDelay time.Duration // Invert is used to indicate that the task success status should be // reversed. Failed tasks count as successful, and vice versa. Invert bool // Jitter is the duration range to randomly add to the Sleep time. // Sleep + [0, Jitter) Jitter time.Duration // Sleep is the duration to pause between individual task invocations. Sleep time.Duration // TaskTime is the maximum time that an individual task invocation is // allowed to take. TaskTime time.Duration // TotalTime is the maximum time that all combined task invocations are // allowed to take. TotalTime time.Duration }
Spec represents the various behavior parameters for retrying a task.
Click to show internal directories.
Click to hide internal directories.