exponential

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: Unlicense Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(options ...Option) backoff.Strategy

New initializes exponential backoff.Strategy. It implements exponential backoff algorithm as defined in https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.

Types

type Option

type Option func(*strategy)

func WithBaseDelay

func WithBaseDelay(d time.Duration) Option

WithBaseDelay is the amount of time to wait before retrying after the first failure. Default is 1 second.

func WithFactor

func WithFactor(factor float64) Option

WithFactor is applied to the backoff after each retry. Default value is 1.6

func WithJitter

func WithJitter(jitter float64) Option

WithJitter provides a range to randomize backoff delays. Default value is 0.2

func WithMaxDelay

func WithMaxDelay(d time.Duration) Option

WithMaxDelay is the upper bound of backoff delay. Default is 180 seconds.

Jump to

Keyboard shortcuts

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