Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
Do retries the given function until defaultMaxInterval time passes, while sleeping some time between unsuccessful attempts if retryOnError returns true, continue retry, otherwise, return error
func DoWithConfig ¶
func DoWithConfig(ctx context.Context, operation func() error, retryOnError func(err error) bool, config *BackoffConfig) error
DoWithConfig will attempt an operation while retrying using an exponential back off based on the config supplied by the caller. The retry decider is the supplied function retryOnError
Types ¶
type BackoffConfig ¶
type BackoffConfig struct {
InitialInterval time.Duration
RandomizationFactor float64
Multiplier float64
MaxInterval time.Duration
// this field will indicate the maximum amount of "sleep" time that will occur.
MaxElapsedTime time.Duration
}
simplified config for configuring a back off object. Callers should populate and supply this to DoWithConfig
func NewBackoffConfig ¶
func NewBackoffConfig() *BackoffConfig
Generate a new BackoffConfig with default values
Source Files
¶
- retry.go
Click to show internal directories.
Click to hide internal directories.