Documentation ¶
Overview ¶
Package retry provides an implementation for retrying http requests with multiple wait strategies
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*OptionsData)
Option is the interface for defining Options
func WithMaxRetry ¶
WithMaxRetry set the max number of times a request is tried
func WithRetryAllMethods ¶
WithRetryAllMethods sets retry on all HTTP methods, overrides WithRetryMethods
func WithRetryMethods ¶
WithRetryMethods specifies the methods that can be retried
func WithStrategy ¶
WithStrategy defines the backoff strategy to be used
type OptionsData ¶
type OptionsData struct { MaxRetry int Methods map[string]bool RetryAllMethods bool Strategy strategy.Strategy }
OptionsData stores all options used across retry
type Retriable ¶
type Retriable interface { //ShouldRetry should return when the failure needs to be retried ShouldRetry(attempt int, req *http.Request, resp *http.Response, err error) bool //WaitDuration should return the duration to wait before making next call WaitDuration(attempt int, req *http.Request, resp *http.Response, err error) time.Duration }
Retriable is the interface implemented by a retrier
Click to show internal directories.
Click to hide internal directories.