expbackoff

package
v0.6.5 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package expbackoff provides an implementation of exponential backoff, useful for preventing client retries from overloading a recovering server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpBackoff

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

ExpBackoff implements an exponential backoff algorithm with random jitter. The algorithm is identical to the one used in the guts of gRPC.

func Build

func Build(rng *rand.Rand, cfg backoff.Config) ExpBackoff

Build returns an ExpBackoff that uses a custom backoff configuration.

func BuildDefault

func BuildDefault() ExpBackoff

BuildDefault returns an ExpBackoff that uses the gRPC default backoff configuration.

func (ExpBackoff) Backoff

func (impl ExpBackoff) Backoff(retries int) time.Duration

Backoff returns the amount of time to wait until the next retry, given the existing retry count.

Jump to

Keyboard shortcuts

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