Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
func Do( ctx context.Context, doer Doer, wantRetry WantRetry, maxAttempts int, retryTime time.Duration, ) (res interface{}, err error)
Do executes the doer function, and retries if needed up to maxAttempts
ctx - the context that if cancelled with prevent any more retry attempts doer - the function that is executed and retried if needed wantRetry - the function that determines if the doer is retried based on the returned error maxAttempts - the maximum number of times the doer function will be attempted retryTime - the initial sleep time between requests. The retryTime will exponentially increase on subsequent retries
Types ¶
type Doer ¶
type Doer = func() (interface{}, error)
Doer provides the function signature for the function that is retried if needed
type ErrAttemptsExceededLimit ¶
type ErrAttemptsExceededLimit struct {
WrappedErr error
}
ErrAttemptsExceededLimit is returned when the number of attempts has reached the maximum permitted
func (ErrAttemptsExceededLimit) Error ¶
func (e ErrAttemptsExceededLimit) Error() string
Error provides the formatted error string for the ErrAttemptsExceededLimit type
Click to show internal directories.
Click to hide internal directories.