From 8da889233d9314a997cf38c08cc37c5e732248e9 Mon Sep 17 00:00:00 2001 From: folbrich Date: Thu, 19 Mar 2026 16:37:57 +0100 Subject: [PATCH] Apply error-retry-base-interval backoff to S3 store retries S3Store respected the error-retry count but retried immediately without delay. Add linear backoff using ErrorRetryBaseInterval before each retry attempt, matching the existing behavior in RemoteHTTP stores. Fixes #321 --- s3.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/s3.go b/s3.go index 64edd69..f4eae34 100644 --- a/s3.go +++ b/s3.go @@ -7,6 +7,7 @@ import ( "io" "net/url" "strings" + "time" minio "github.com/minio/minio-go/v6" "github.com/minio/minio-go/v6/pkg/credentials" @@ -95,6 +96,7 @@ retry: obj, err := s.client.GetObject(s.bucket, name, minio.GetObjectOptions{}) if err != nil { if attempt <= s.opt.ErrorRetry { + time.Sleep(time.Duration(attempt) * s.opt.ErrorRetryBaseInterval) goto retry } return nil, errors.Wrap(err, s.String()) @@ -104,6 +106,7 @@ retry: b, err := io.ReadAll(obj) if err != nil { if attempt <= s.opt.ErrorRetry { + time.Sleep(time.Duration(attempt) * s.opt.ErrorRetryBaseInterval) goto retry } if e, ok := err.(minio.ErrorResponse); ok { @@ -135,6 +138,7 @@ retry: _, err = s.client.PutObject(s.bucket, name, bytes.NewReader(b), int64(len(b)), minio.PutObjectOptions{ContentType: contentType}) if err != nil { if attempt < s.opt.ErrorRetry { + time.Sleep(time.Duration(attempt) * s.opt.ErrorRetryBaseInterval) goto retry } }