backoff

package
v0.0.0-...-16416bd Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backoff

func Backoff(retries int) time.Duration

Backoff returns the amount of time to wait before the next retry given the number of consecutive failures. NOTE: Default config will be used.

Types

type Config

type Config struct {
	// MaxDelay is the upper bound of backoff delay.
	MaxDelay time.Duration

	// baseDelay is the amount of time to wait before retrying after the first
	// failure.
	BaseDelay time.Duration

	// factor is applied to the backoff after each retry.
	Factor float64

	// jitter provides a range to randomize backoff delays.
	Jitter float64
}

Config defines the parameters for the default backoff strategy.

func (*Config) Backoff

func (bc *Config) Backoff(retries int) time.Duration

Backoff returns the amount of time to wait before the next retry given the number of consecutive failures.

Jump to

Keyboard shortcuts

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