backoff

package
v0.6.52 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 5 Imported by: 0

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