backoff

package
v0.71.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package backoff holds the retry-delay policies shared by the outbox relay, the queue and webhook batteries, and the log webhook sink. It is dependency-free and low-level so the framework tree and the batteries (which sit above it but not above each other) reuse one implementation instead of maintaining copies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func At

func At(table []time.Duration, attempts int) time.Duration

At returns the wait after the given attempt from a positional schedule: table[attempts-1], reusing the final entry once attempts runs past the table. attempts < 1 reads as the first attempt; an empty table yields zero.

func Exponential

func Exponential(base, max time.Duration, attempts int) time.Duration

Exponential returns the delay before the next retry for the attempt that just failed (attempts >= 1): base*2^(attempts-1), clamped to max when max is positive. attempts <= 1 yields base. A zero base yields zero. Callers gate on base > 0 before applying backoff. Doubling stops at the largest value whose next doubling could overflow int64, so any attempt count is safe.

Types

This section is empty.

Jump to

Keyboard shortcuts

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