Skip to content

Commit

Permalink
terminate recursion!
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Nov 7, 2021
1 parent 9426566 commit f380302
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ func (s *S3Bucket) getSize(k ds.Key, retries int, sleepMillis int) (size int, er
})
if err != nil {
if s3Err, ok := err.(awserr.Error); ok && s3Err.Code() == "ServiceUnavailable" {
if retries == 0 {
return -1, err
}
time.Sleep(time.Duration(sleepMillis) * time.Millisecond)
return s.getSize(k, retries-1, sleepMillis*2)
}
Expand Down

0 comments on commit f380302

Please sign in to comment.