Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

backoff

v1.14.0
github.com/bglmmz/grpc/internal/backoff

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

4 matches

Top ↑

Package backoff implement the backoff strategy for gRPC.

This is kept in internal until the gRPC project decides whether or not to allow alternative backoff strategies.

Types

Exponential

type Exponential struct {
	// MaxDelay is the upper bound of backoff delay.
	MaxDelay time.Duration
}

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

Exponential.Backoff

func (bc Exponential) Backoff(retries int) time.Duration

Backoff returns the amount of time to wait before the next retry given the number of retries.

Strategy

type Strategy interface {
	// Backoff returns the amount of time to wait before the next retry given
	// the number of consecutive failures.
	Backoff(retries int) time.Duration
}

Strategy defines the methodology for backing off after a grpc connection failure.

Dependency graph