Help us shape the future of Go! Take the 2026 Go Developer Survey

backoff

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package backoff — exponential / constant / zero backoff helpers.

Использует cenkalti/backoff/v4 как базовую реализацию.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Stop — sentinel-значение, сигнализирующее «больше не повторять».
	Stop = backoff.Stop

	// WithContext оборачивает Backoff в context-aware вариант.
	WithContext = backoff.WithContext
)

Functions

func ExponentialBackoffBuilder

func ExponentialBackoffBuilder() exponentialBackoffBuilder

ExponentialBackoffBuilder создает builder для exponential backoff.

bo := backoff.ExponentialBackoffBuilder().
    WithInitialInterval(100 * time.Millisecond).
    WithMultiplier(2.0).
    WithMaxInterval(5 * time.Second).
    WithMaxElapsedThreshold(30 * time.Second).
    WithRandomizationFactor(0.2).
    Build()

Types

type BackOffContext

type BackOffContext = backoff.BackOffContext //nolint:revive

BackOffContext — alias на backoff.BackOffContext.

type Backoff

type Backoff = backoff.BackOff

Backoff — alias на backoff.BackOff.

func NewConstantBackOff

func NewConstantBackOff(d time.Duration) Backoff

NewConstantBackOff возвращает backoff с фиксированным интервалом d.

Jump to

Keyboard shortcuts

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