Documentation
¶
Overview ¶
Package retry provides configurable retry policies with backoff strategies for gofly service calls.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BackoffFunc ¶
BackoffFunc computes the delay before a given retry attempt.
func ExponentialBackoff ¶
func ExponentialBackoff(base, max time.Duration) BackoffFunc
ExponentialBackoff returns a BackoffFunc that doubles the delay on each attempt, capped at max.
func FixedBackoff ¶
func FixedBackoff(d time.Duration) BackoffFunc
FixedBackoff returns a BackoffFunc that always returns d.
func JitterBackoff ¶
func JitterBackoff(next BackoffFunc, ratio float64) BackoffFunc
JitterBackoff wraps a BackoffFunc and adds random jitter within ±ratio of the computed delay, smoothing thundering-herd retries.
type MaxRetriesBudget ¶
type MaxRetriesBudget struct {
MaxRetries int
}
MaxRetriesBudget allows retries up to a fixed maximum.
func (MaxRetriesBudget) AllowRetry ¶
func (b MaxRetriesBudget) AllowRetry(retry int, err error) bool
AllowRetry reports whether retry is within the configured maximum.
Click to show internal directories.
Click to hide internal directories.