+119
−0
Loading
The s3_v2 driver shared a single cenkalti/backoff.ExponentialBackOff across every request and retry for the life of the client. That object is stateful and not safe for concurrent use, which caused two bugs: - A data race on the backoff's internal currentInterval, reachable from concurrent S3 requests through BackoffDelay (flagged by go test -race). - The interval only ever grew and stuck at the 60s cap, since it was never reset, so a fresh request's first retry could wait ~60s instead of starting near 500ms. Replace it with a stateless delayForAttempt that computes the delay in closed form from the attempt number the SDK passes in: an exponential curve (InitialInterval * Multiplier^(attempt-1), capped at MaxInterval) jittered by ±RandomizationFactor, using the same common.Default* parameters as before so retry timing is unchanged. Being stateless, a single delayer is safe to share across concurrent requests and every request restarts the curve at attempt 1. The driver still depends on cenkalti/backoff elsewhere; only this file stops using it directly. This backports artifact-registry!635. Related to gitlab-org/ops/artifact-registry#204 Co-Authored-By:Claude Opus 4.8 (1M context) <noreply@anthropic.com>