backoff

package
v0.0.0-...-0f8ae5d Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2019 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExponentialBackoff

func ExponentialBackoff(i int, unit time.Duration) time.Duration

Types

type Instance

type Instance struct {
	MaxRetries         int
	BaseRetryDuration  time.Duration
	BackoffPolicy      Policy
	MaxBackoffDuration time.Duration
	Attempt            int
	Ctx                context.Context
}

func New

func New() *Instance

func (*Instance) Backoff

func (i *Instance) Backoff(ctx context.Context) (finished bool)

func (*Instance) C

func (i *Instance) C(ctx context.Context) <-chan int

type Policy

type Policy func(i int, unit time.Duration) time.Duration

Jump to

Keyboard shortcuts

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