retry

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: MIT Imports: 3 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 retry computes when a failed or stalled attempt may run again (方案 §15.4): an exponential backoff with a reproducible jitter.

Reproducible means the delay is a pure function of the attempt number and a stable seed (the work item's identifier): the same failure on a restarted scheduler produces the same instant, which is what makes "到期判定在 tick 时 求值" checkable. Randomness would make the plan unreproducible across restarts, so the jitter is derived, not drawn.

Index

Constants

View Source
const DefaultBase = 30 * time.Second

DefaultBase is the delay before the second attempt when nothing declares one.

View Source
const DefaultMax = time.Hour

DefaultMax caps the delay when nothing declares one (方案 §15.4 退避上限).

View Source
const DefaultStallThreshold = 30 * time.Minute

DefaultStallThreshold is how long an attempt may make no progress before the tick treats it as stalled (方案 §15.4) when the policy declares none.

Variables

This section is empty.

Functions

func Delay

func Delay(base, max time.Duration, attempt int, seed string) time.Duration

Delay is the wait before the given attempt (1 = the first retry, i.e. the second attempt). base and max are the policy's bounds; zero or negative values fall back to the defaults. max is a hard ceiling: a policy may ask for retries sooner than the base (a small backoff_max_seconds is a legitimate "retry quickly"), and the jitter is clamped below it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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