Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DoWithRetry ¶
DoWithRetry will execute a function as many times as is dictated by any retryable errors propagated by the function
func WrapRetryableError ¶
func WrapRetryableError(err error, errorList []*regexp.Regexp, errorCreator ErrorCreator) error
WrapRetryableError takes an error, and given a set of retryable error regexes, returns a suitable error type, either a standard error or a retryable error
Types ¶
type ErrorCreator ¶
type ErrorCreator func(error) RetryableError
ErrorCreator is a type of function that creates retryable errors from standard errors
type RetryableError ¶
RetryableError is an interface for any kind of error allowing retries
func NewBackoffRetryableError ¶
func NewBackoffRetryableError(err error, maxAttempts int) RetryableError
NewBackoffRetryableError creates a RetryableError which will retry up to maxAttempts times using an exponential backoff
func NewLogarithmicRetryableError ¶
func NewLogarithmicRetryableError(err error, maxAttempts int, baseOffset, scale, power float64) RetryableError
NewLogarithmicRetryableError creates a RetryableError which will retry up to maxAttempts times, with a sleep pattern defined by a logarithmic curve
func NewStaticRetryableError ¶
func NewStaticRetryableError(err error, maxAttempts, waitSeconds int) RetryableError
NewStaticRetryableError creates a RetryableError which will retry up to maxAttempts times sleeping waitSeconds in between tries