backoff

package
v0.6.123 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package backoff is the SDK's retry policy as a value: bounds the author can set, run by github.com/cenkalti/backoff (exponential, jittered, so instances recovering from one outage do not retry in lockstep).

Index

Constants

This section is empty.

Variables

View Source
var ErrPolicy = errors.New("backoff: want 0 < min <= max")

ErrPolicy: a policy that would spin or never grow.

Functions

func Retry

func Retry(
	ctx context.Context, p Policy, fn func(ctx context.Context) error, onRetry func(err error, in time.Duration),
) error

Retry calls fn until it succeeds or ctx ends, with no limit on attempts; onRetry sees every failure with the delay before the next attempt.

Types

type Policy

type Policy struct {
	Min, Max time.Duration
}

Policy bounds the delay between attempts.

func (Policy) Validate

func (p Policy) Validate() error

Validate rejects a policy that would spin or never grow.

Jump to

Keyboard shortcuts

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