Skip to content

Commit

Permalink
storage/s3: add SlowDown as retryable (#507)
Browse files Browse the repository at this point in the history
in [v0.7.0](https://github.com/peak/s5cmd/blob/v0.7.0/core/error.go#L49), SlowDown was a retryable error. 

Add that again as retryable because with #506, one might get slowdown errors while testing with other endpoint urls.
  • Loading branch information
boraberke committed Sep 2, 2022
1 parent deb16c9 commit d21a491
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion storage/s3.go
Expand Up @@ -978,7 +978,7 @@ func newCustomRetryer(maxRetries int) *customRetryer {
// ShouldRetry overrides SDK's built in DefaultRetryer, adding custom retry
// logics that are not included in the SDK.
func (c *customRetryer) ShouldRetry(req *request.Request) bool {
shouldRetry := errHasCode(req.Error, "InternalError") || errHasCode(req.Error, "RequestTimeTooSkewed") || strings.Contains(req.Error.Error(), "connection reset") || strings.Contains(req.Error.Error(), "connection timed out")
shouldRetry := errHasCode(req.Error, "InternalError") || errHasCode(req.Error, "RequestTimeTooSkewed") || errHasCode(req.Error, "SlowDown") || strings.Contains(req.Error.Error(), "connection reset") || strings.Contains(req.Error.Error(), "connection timed out")
if !shouldRetry {
shouldRetry = c.DefaultRetryer.ShouldRetry(req)
}
Expand Down
5 changes: 5 additions & 0 deletions storage/s3_test.go
Expand Up @@ -447,6 +447,11 @@ func TestS3Retry(t *testing.T) {
err: awserr.New("RequestTimeTooSkewed", "The difference between the request time and the server's time is too large.", nil),
expectedRetry: 5,
},
{
name: "SlowDown",
err: awserr.New("SlowDown", "Please reduce your request rate.", nil),
expectedRetry: 5,
},

// Throttling errors
{
Expand Down

0 comments on commit d21a491

Please sign in to comment.