expbackoff

package
Version: v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 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
t or T : Toggle theme light dark auto
y or Y : Canonical URL