backoff

package
v1.25.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 15, 2019 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff interface {
	Duration() time.Duration
	ShouldRetry() bool
}

Backoff defines a back-off/retry interface

func NewBackoff

func NewBackoff(min, max time.Duration, jitterMultiple, multiple float64, maxRetries int) Backoff

NewBackoff creates a Backoff which ranges from min to max increasing by multiple each time. It also adds (and yes, the jitter is always added, never subtracted) a random amount of jitter up to jitterMultiple percent (that is, jitterMultiple = 0.0 is no jitter, 0.15 is 15% added jitter). The total time may exceed "max" when accounting for jitter, such that the absolute max is max + max * jiterMultiple

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL