Documentation ¶
Overview ¶
Package backoffutil provides a wrapper above github.com/cenk/backoff.Retry that checks the error returned and only retries retryable errors.
For the sake of simplicity, the backoff strategy is the default exponential backoff.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Retry ¶
Retry does exponential backoff. Backoff will trigger if an error is returned, implements Retryabler AND the error is retryable.
Example ¶
Retry(func() error { resp, err := http.Get("http://www.example.com") if err != nil { return errorutil.RetryableError(err) } defer resp.Body.Close() if err := errorutil.HTTPError(resp); err != nil { return err } // Do something return nil })
Output:
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.