Documentation
¶
Overview ¶
Package retry provides utilities for retrying operations with exponential backoff
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Do ¶
func Do(ctx context.Context, cfg *Config, fn RetryableFunc) error
Do executes the function with retries according to the config.
func DoWithNotify ¶
func DoWithNotify(ctx context.Context, cfg *Config, fn RetryableFunc, notify func(error, time.Duration)) error
DoWithNotify executes the function with retries and calls notify on each retry.
func NonRetryable ¶
NonRetryable wraps an error to make it non-retryable
Types ¶
type Config ¶
type Config struct {
MaxRetries int
InitialBackoff time.Duration
MaxBackoff time.Duration
Multiplier float64
Jitter float64 // 0.0-1.0, fraction of backoff to randomize (e.g. 0.25 = +/-25%)
}
Config represents retry configuration
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns a default retry configuration
type RetryableError ¶
RetryableError indicates whether an error is retryable
type RetryableFunc ¶
type RetryableFunc func() error
RetryableFunc is a function that can be retried
Click to show internal directories.
Click to hide internal directories.