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 ¶
var RetryableStatuses = map[int]struct{}{ http.StatusRequestTimeout: {}, http.StatusTooManyRequests: {}, http.StatusInternalServerError: {}, http.StatusBadGateway: {}, http.StatusServiceUnavailable: {}, http.StatusGatewayTimeout: {}, }
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 ¶
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 ¶
IsRetryableStatus reports whether the given HTTP status code is a transient object-storage failure that warrants a retry.
Types ¶
This section is empty.