Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RetryExhaustedError error = fmt.Errorf("Function never succeeded in Retry")
Functions ¶
func Run ¶
func Run(initialInterval float64, maxInterval float64, numTries uint, function RetryableFunc) error
Run retries a function up to numTries times with exponential backoff. If numTries == 0, retry indefinitely. If interval == 0, Retry will not delay retrying and there will be no exponential backoff. If maxInterval == 0, maxInterval is set to +Infinity. Intervals are in seconds. Returns an error if initial > max intervals, if retries are exhausted, or if the passed function returns an error.
Types ¶
type RetryableFunc ¶
RetryableFunc performs an action and returns a bool indicating whether the function is done, or if it should keep retrying, and an error which will abort the retry and be returned by the Retry function. The 0-indexed attempt is passed with each call.
Click to show internal directories.
Click to hide internal directories.