exponential

package
v0.0.0-...-4892902 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const NoiseDelayMs = 1000 // Each delay has random additional milliseconds.

Variables

View Source
var Backoff5Min = NewBackoff(time.Second, 5*time.Minute, 2.0)

Backoff5Min goes from 1 second to 5 minutes with each delay is twice bigger.

Functions

This section is empty.

Types

type Backoff

type Backoff struct {
	// contains filtered or unexported fields
}

func NewBackoff

func NewBackoff(initial time.Duration, max time.Duration, factor float64) *Backoff

func (Backoff) Delay

func (b Backoff) Delay(retries int) time.Duration

Delay returns delay distributed from initial to max.

Example:

Retry 0: 5s
Retry 1: 6s
Retry 2: 7.8s
Retry 3: 9.8s
Retry 4: 13s
Retry 5: 21s
Retry 6: 32s
Retry 7: 32s

Jump to

Keyboard shortcuts

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