exponential_backoff

package
v1.0.0-beta.13 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const ExponentialDelayFactor float64 = 2.0 // Each delay is twice longer.
View Source
const ExponentialDelayRandomMs = 1000 // Each delay has random additional milliseconds.
View Source
const MaxExponentialBackoffDelay = time.Duration(32 * time.Second)

Variables

This section is empty.

Functions

func CalculateDelay

func CalculateDelay(initialDelay time.Duration, retryCount int) time.Duration

CalculateDelay returns delay distributed from initialDelay to default maxDelay (32s)

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

func CalculateDelayWithMax

func CalculateDelayWithMax(initialDelay time.Duration, maxDelay time.Duration, retryCount int) time.Duration

Types

This section is empty.

Jump to

Keyboard shortcuts

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