Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Retryable ¶
Retryable returns true for common errors that are considered retryable, i.e. temporary, timeout, DNS, connection refused and reset, host down and unreachable and network down and unreachable errors.
func WithBackoff ¶
func WithBackoff( ctx context.Context, retryableFunc RetryableFunc, retryable IsRetryable, b backoff.Backoff, settings Settings, ) (err error)
WithBackoff retries the passed function if it fails and the error allows it to retry. The specified backoff policy is used to determine how long to sleep between attempts.
Types ¶
type IsRetryable ¶
IsRetryable checks whether a new attempt can be started based on the error passed.
type OnErrorFunc ¶
OnErrorFunc is called if an error occurs.
type OnSuccessFunc ¶
OnSuccessFunc is called once the operation succeeds.
type RetryableFunc ¶
RetryableFunc is a retryable function.
type Settings ¶
type Settings struct { // Timeout lets WithBackoff give up once elapsed (if >0). Timeout time.Duration // OnError is called if an error occurs. OnError OnErrorFunc // OnSuccess is called once the operation succeeds. OnSuccess OnSuccessFunc }
Settings aggregates optional settings for WithBackoff.
Click to show internal directories.
Click to hide internal directories.