retry

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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