From 983bd0e70a2c3333ca7c93fc6c8e7b67535b6b2d Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 5 Aug 2024 18:46:35 +0300 Subject: [PATCH] Also retry initial mounting --- internal/backend_s3.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/backend_s3.go b/internal/backend_s3.go index ef1ea0cf..159e7e2e 100644 --- a/internal/backend_s3.go +++ b/internal/backend_s3.go @@ -360,13 +360,21 @@ func (s *S3Backend) detectBucketLocationByHEAD() (err error, isAws bool) { } func (s *S3Backend) testBucket(key string) (err error) { - _, err = s.HeadBlob(&HeadBlobInput{Key: key}) + oldAttempts := s.flags.ReadRetryAttempts + if oldAttempts == 0 { + // Never wait infinitely for init + s.flags.ReadRetryAttempts = 5 + } + err = ReadBackoff(s.flags, func(attempt int) error { + _, err := s.HeadBlob(&HeadBlobInput{Key: key}); + return err + }) if err != nil { if mapAwsError(err) == syscall.ENOENT { err = nil } } - + s.flags.ReadRetryAttempts = oldAttempts return }