Documentation ¶
Index ¶
- Constants
- func IsRetryableDefault(err error) bool
- func IsRetryableNoOp(err error) bool
- type Config
- type Retry
- func (r *Retry) Do(req *http.Request, do func(*http.Request) (*http.Response, error)) (*http.Response, error)
- func (c *Retry) SetIsRetryable(f ...func(err error) bool) *Retry
- func (c *Retry) SetMaxRetries(r int) *Retry
- func (c *Retry) SetThrottle(d time.Duration) *Retry
- func (c *Retry) SetTimeout(d time.Duration) *Retry
- func (c *Retry) SetUntil(f ...UntilFn) *Retry
- type UntilFn
Constants ¶
View Source
const ( // timeout configuration constants CONFIG_IS_RETRYABLE = "IsRetryable" // requesrt errors ERR_NO_SUCH_HOST = "dial tcp: lookup" )
View Source
const ( // timeout configuration constants CONFIG_THROTTLE = "Throttle" CONFIG_THROTTLE_DEFAULT = 1 * time.Second )
View Source
const ( // timeout configuration constants CONFIG_TIMEOUT = "Timeout" CONFIG_TIMEOUT_DEFAULT = 2 * time.Minute )
View Source
const (
// name of the configuration
CONFIG_MAX_RETRIES = "MaxRetries"
)
View Source
const (
// Wait configuration constants
CONFIG_UNTIL = "Until"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Retry ¶
type Retry struct {
// contains filtered or unexported fields
}
func (*Retry) Do ¶
func (r *Retry) Do(req *http.Request, do func(*http.Request) (*http.Response, error)) (*http.Response, error)
Do runs a given do function with a given request -> do(req)
func (*Retry) SetIsRetryable ¶
SetIsRetryable sets functions that determin if an error can be retried or not
func (*Retry) SetMaxRetries ¶
SetMaxRetries sets the maximum retries
func (*Retry) SetThrottle ¶
SetThrottle sets the duration to wait between calls
func (*Retry) SetTimeout ¶
SetTimeout sets the maximum run duration
Click to show internal directories.
Click to hide internal directories.