backoff

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package backoff implements the backoff strategy for gRPC calls from client. https://github.com/grpc/grpc-go/blob/master/internal/backoff/backoff.go

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	BaseDelay:  2.0 * time.Second,
	Multiplier: 3.0,
	MaxDelay:   15.0 * time.Second,
	Jitter:     0.2,
}

DefaultConfig is a backoff configuration with the default values specified at https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md.

Functions

This section is empty.

Types

type Config

type Config struct {
	// BaseDelay is the amount of time to backoff after the first failure.
	BaseDelay time.Duration
	// Multiplier is the factor with which to multiply backoffs after a
	// failed retry. Should ideally be greater than 1.
	Multiplier float64
	// MaxDelay is the upper bound of backoff delay.
	MaxDelay time.Duration
	// Jitter is the factor with which backoffs are randomized.
	Jitter float64
}

Config defines the configuration options for backoff

func (*Config) Backoff

func (bc *Config) Backoff(attempt uint) time.Duration

Backoff returns the amount of time to wait before the next retry given the number of retries. https://github.com/grpc/proposal/blob/master/A6-client-retries.md#exponential-backoff

Jump to

Keyboard shortcuts

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