Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch get_bucket_location IOError in send_file #502

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion S3/S3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,18 @@ def send_file(self, request, file, labels, buffer = '', throttle = 0, retries =
method_string, resource, headers = request.get_triplet()
if S3Request.region_map.get(request.resource['bucket'], None) is None:
s3_uri = S3Uri(u's3://' + request.resource['bucket'])
region = self.get_bucket_location(s3_uri)
try:
region = self.get_bucket_location(s3_uri)
except Exception, e:
if retries:
warning("Retrying get_bucket_location: %s (%s)" % (s3_uri, e))
warning("Waiting %d sec..." % self._fail_wait(retries))
time.sleep(self._fail_wait(retries))
# Connection error -> same throttle value
return self.send_file(request, file, labels, buffer, throttle, retries - 1, offset, chunk_size)
else:
raise S3UploadError("Get bucket location failed for: %s" % resource['uri'])

if region is not None:
S3Request.region_map[request.resource['bucket']] = region

Expand Down