Documentation
¶
Overview ¶
Package backoff provides exponential backoff retry logic.
Index ¶
Constants ¶
View Source
const ( DefaultMaxRetries = 3 DefaultRetryInterval = 2 * time.Second DefaultMaxInterval = 30 * time.Second )
Default configuration values.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*Options)
Option is a function that applies an option to an Options instance.
func WithMaxInterval ¶
WithMaxInterval sets the maximum interval between retry attempts.
func WithMaxRetries ¶
WithMaxRetries sets the maximum number of retry attempts.
func WithRetryInterval ¶
WithRetryInterval sets the initial interval between retry attempts.
type Options ¶
type Options struct {
// MaxRetries is the maximum number of retry attempts.
// Default is 3.
MaxRetries int `json:"gmt_max_retries" mapstructure:"gmt_max_retries"`
// Interval is the initial interval between retry attempts.
// Default is 2 seconds.
Interval time.Duration `json:"gmt_retry_interval" mapstructure:"gmt_retry_interval"`
// MaxInterval is the maximum interval between retry attempts.
// Default is 30 seconds.
MaxInterval time.Duration `json:"gmt_retry_max_interval" mapstructure:"gmt_retry_max_interval"`
}
Options is the configuration options for retry operations.
Click to show internal directories.
Click to hide internal directories.