retry

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 7 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackOff

func BackOff(ctx context.Context, t time.Duration)

BackOff sleeps for the given duration and respects context cancellation.

func CloneRequestForRetry

func CloneRequestForRetry(req *http.Request) (*http.Request, error)

func DoWithApplicationRetry

func DoWithApplicationRetry(
	cfg *shared.Configuration,
	request *http.Request,
) (*http.Response, time.Duration, error)

DoWithApplicationRetry executes an HTTP request with application-level retry logic. This is the shared equivalent of the per-product callAPI method.

Retry behaviour:

  • 502/503/504: retries with backoff (skips POST)
  • 429: retries honoring Retry-After header, falls back to waitTime
  • Other status codes or transport errors: returns immediately
  • Respects context cancellation during backoff

Interaction with RoundTripper

client.Do invokes the configured http.RoundTripper, which may be a RoundTripper. When a multi-server Strategy is active, transport-level network errors and status codes listed in FailoverOnStatusCodes are handled by the round tripper before this function sees the response: it either receives a successful response or err != nil after all failover attempts are exhausted.

Status codes NOT in FailoverOnStatusCodes (including the 502/503/504/429 that this function retries on) pass through normally.

Worst-case total attempts: Configuration.MaxRetries × Options.MaxRetries.

Types

This section is empty.

Jump to

Keyboard shortcuts

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