retry

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package retry computes the deterministic backoff schedule for redeliveries and decides when a delivery has exhausted its budget. It is pure logic.

Index

Constants

This section is empty.

Variables

View Source
var DefaultBackoff = core.BackoffConfig{
	BaseDelay:   2 * time.Second,
	Multiplier:  3,
	MaxDelay:    time.Hour,
	MaxAttempts: 8,
}

DefaultBackoff is used when a destination sets no override.

Functions

This section is empty.

Types

type Plan

type Plan struct {
	// DeadLetter is true when the retry budget is exhausted; Delay is then
	// meaningless.
	DeadLetter bool
	// Delay is how long to wait before the next attempt.
	Delay time.Duration
}

Plan is the scheduler's decision after an attempt completes.

func Next

func Next(cfg core.BackoffConfig, attempt int, retryAfter time.Duration) Plan

Next decides what to do after the given attempt number has failed. attempt is 1-based: 1 means the first attempt just failed. When attempt reaches MaxAttempts the delivery is dead-lettered.

When retryAfter is non-zero (a 429 Retry-After), it overrides the computed backoff for this step.

Jump to

Keyboard shortcuts

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