Skip to content

Commit

Permalink
Retry on AccessDenied only in restricted cases (#1121)
Browse files Browse the repository at this point in the history
List buckets should be retried on an AccessDenied error only if the
region in the reponse is only different from the region in the request
just made.
  • Loading branch information
donatello authored and kannappanr committed Jun 11, 2019
1 parent 0cbba03 commit 91be771
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,15 @@ func (c Client) executeMethod(ctx context.Context, method string, metadata reque
}
} else {
// Most probably for ListBuckets()
metadata.bucketLocation = errResponse.Region
continue // Retry
if errResponse.Region != metadata.bucketLocation {
// Retry if the error
// response has a
// different region
// than the request we
// just made.
metadata.bucketLocation = errResponse.Region
continue // Retry
}
}
}
}
Expand Down

0 comments on commit 91be771

Please sign in to comment.