Skip to content

Commit

Permalink
api: Check for Code 'InvalidRegion' for retrying with server Region.
Browse files Browse the repository at this point in the history
  • Loading branch information
harshavardhana authored and minio-trusted committed Apr 4, 2017
1 parent 6f66f63 commit 3860993
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,9 +543,9 @@ func (c Client) executeMethod(method string, metadata requestMetadata) (res *htt

// For errors verify if its retryable otherwise fail quickly.
errResponse := ToErrorResponse(httpRespToErrorResponse(res, metadata.bucketName, metadata.objectName))
// Bucket region if set in error response, we can retry the
// request with the new region.
if errResponse.Region != "" {
// Bucket region if set in error response and the error code dictates invalid region,
// we can retry the request with the new region.
if errResponse.Code == "InvalidRegion" && errResponse.Region != "" {
c.bucketLocCache.Set(metadata.bucketName, errResponse.Region)
continue // Retry.
}
Expand Down

0 comments on commit 3860993

Please sign in to comment.