Documentation ¶
Index ¶
Constants ¶
View Source
const MaxRetriesInfinite = -1
MaxRetriesInfinite constant indicate that the middleware should never give up retrying
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(config Config) endpoint.Middleware
New tries to execute @next.Process() until it succeeds. Each failure is followed by an exponentially increasing delay.
Types ¶
type Config ¶
type Config struct { // InitialDelay represents the delay after the first error, before adding // the spread InitialDelay time.Duration // MaxDelay represents the max delay after an error, before adding the // spread MaxDelay time.Duration // Spread is the percentage of the current delay that can be added as a // random term. For example, with a delay of 10s and 20% spread, the // calculated delay will be between 10s and 12s. Spread float64 // Factor represents how bigger the next delay wil be in comparison to the // current one Factor float64 // MaxRetries indicates how many times this middleware should retry. // SeverityRuntime errors are always retried and don't count . SeverityInput errors are never retried. MaxRetries int }
Config contains the config for the exponential backoff retrier
func NewDefaultConfig ¶
func NewDefaultConfig() Config
NewDefaultConfig returns a ready-to-use Config with sane defaults
Click to show internal directories.
Click to hide internal directories.