Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { // Retry until timeout elapsed, 0 means forever Timeout time.Duration // MaxTries is max retry times, 0 means forever MaxTries int // RetryDelay returns dealy time after failed, default is 1s RetryDelay func() time.Duration // ShouldRetry returns wether error should be retried, default true ShouldRetry func(error) bool }
Config represents a retry config
type ExhaustedType ¶
type ExhaustedType string
ExhaustedType is retry exhausted type
const ( // Timeout is retry exhausted timeout Timeout ExhaustedType = "Timeout" // MaxTries is retry exhausted max times MaxTries ExhaustedType = "MaxTries" // Cancelled is retry is cancelled Cancelled ExhaustedType = "Cancelled" // NonRetry is non retryable NonRetry ExhaustedType = "NonRetry" )
type RetryError ¶
RetryError is an error with retryable info
func NonRetryableError ¶
func NonRetryableError(err error) *RetryError
NonRetryableError returns a not retryable error
func RetryableError ¶
func RetryableError(err error) *RetryError
RetryableError returns a retryable error
func (*RetryError) Error ¶
func (err *RetryError) Error() string
Error returns string of retry error
type RetryExhaustedError ¶
type RetryExhaustedError struct { Err error Type ExhaustedType Times int }
RetryExhaustedError is max retry exhausted error
func (*RetryExhaustedError) Error ¶
func (err *RetryExhaustedError) Error() string
Error returns string of max retry exhausted error
Click to show internal directories.
Click to hide internal directories.