Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstantBackoff ¶
type ConstantBackoff struct{}
ConstantBackoff implements Backoff where the returned delay will always be the base delay.
func Constant ¶
func Constant() ConstantBackoff
type ExponentialBackoff ¶
type ExponentialBackoff struct { // Factor is used to calculate the exponentially increasing the backoff delay. Factor int64 }
ExponentialBackoff satisfies Backoff and will cause exponentially increasing delay.
Formula: x(n) = b × fⁿ⁻¹ ± j, where n is the number of adverse events.
func Exponential ¶
func Exponential(factor int64) ExponentialBackoff
type LinearBackoff ¶
type LinearBackoff struct { // Slope is the multiplicative factor m in "f(n) = m × n + b" where n is the number of adverse effects and b is the // base delay. A slope factor of 1.0 will cause the base delay to be multiplied with the number of adverse events // and is therefore at a 45° angle. Slope float64 }
LinearBackoff satisfies Backoff and will cause a linearly increasing delay.
func Linear ¶
func Linear(m float64) LinearBackoff
type MaxAdverseEventsReachedError ¶
func (MaxAdverseEventsReachedError) Error ¶
func (e MaxAdverseEventsReachedError) Error() string
type Retryable ¶
type Retryable struct { Backoff Backoff MaxAdverseEvents uint BaseDelay time.Duration MaxDelay time.Duration Jitter time.Duration }
func (*Retryable) RetryWithTimeout ¶
RetryWithTimeout is a wrapper of Retry which will abort the retries when timeout has been reached. This function only provides what you could do yourself by passing a context with a deadline.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.