retry

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package retry provides shared HTTP retry/backoff helpers for transient object-storage failures (S3 SlowDown, 5xx, etc.). Used by the CloudFetch download path and the staging-operation (PUT/GET/REMOVE) handlers so both share a single retryable-status set and backoff schedule.

Index

Constants

This section is empty.

Variables

RetryableStatuses lists HTTP status codes from object storage that indicate transient conditions and warrant a retry. Mirrors AWS S3 guidance for SlowDown (503) / InternalError (500) plus the general 408/429/502/504.

Functions

func Backoff

func Backoff(attempt int, waitMin, waitMax time.Duration, retryAfter string) time.Duration

Backoff returns the wait before retry attempt N (1-based). The base delay is exponential — waitMin * 2^(attempt-1) capped at waitMax — with equal jitter applied: the actual sleep is uniformly distributed in [base/2, base]. Equal jitter (rather than no jitter) spreads synchronized retries across concurrent callers, which would otherwise hammer the storage endpoint in lockstep after a region-wide blip. If the server returned a parseable integer Retry-After header, that value (in seconds) is honored instead, capped at waitMax. HTTP-date Retry-After values are ignored — same as the Thrift client's backoff.

func IsRetryableStatus

func IsRetryableStatus(status int) bool

IsRetryableStatus reports whether the given HTTP status code is a transient object-storage failure that warrants a retry.

Types

This section is empty.

Jump to

Keyboard shortcuts

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