Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Retrier ¶
type Retrier struct {
// contains filtered or unexported fields
}
func New ¶
func New(timeout time.Duration, opts ...RetrierOpt) *Retrier
New creates a new retrier with a global timeout (max time allowed for the whole execution) The default retry policy is to always retry with no wait time in between retries.
func NewWithMaxRetries ¶
NewWithMaxRetries creates a new retrier with no global timeout and a max retries policy.
func NewWithNoTimeout ¶ added in v0.14.4
func NewWithNoTimeout() *Retrier
NewWithNoTimeout creates a new retrier with no global timeout and infinite retries.
type RetrierOpt ¶
type RetrierOpt func(*Retrier)
func WithBackoffFactor ¶ added in v0.7.0
func WithBackoffFactor(factor float32) RetrierOpt
func WithMaxRetries ¶
func WithMaxRetries(maxRetries int, backOffPeriod time.Duration) RetrierOpt
WithMaxRetries sets a retry policy that will retry up to maxRetries times with a wait time between retries of backOffPeriod.
func WithRetryPolicy ¶
func WithRetryPolicy(policy RetryPolicy) RetrierOpt
type RetryPolicy ¶
RetryPolicy allows to customize the retrying logic. The boolean retry indicates if a new retry should be performed and the wait duration indicates the wait time before the next retry.
func BackOffPolicy ¶ added in v0.18.0
func BackOffPolicy(backoff time.Duration) RetryPolicy
BackOffPolicy retries until top level timeout is reached, waiting a backoff period in between retries.