Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Tweaking the throughput throttling exception handling for Amazon Dyna…
Browse files Browse the repository at this point in the history
…moDB module.
  • Loading branch information
garnaat committed Jan 31, 2012
1 parent 8167916 commit c0ff68a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions boto/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ def _mexe(self, request, sender=None, override_num_retries=None,
msg, i, next_sleep = status
if msg:
boto.log.debug(msg)
time.sleep(next_sleep)
continue
if response.status == 500 or response.status == 503:
msg = 'Received %d response. ' % response.status
Expand Down
6 changes: 2 additions & 4 deletions boto/dynamodb/layer1.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ def _retry_handler(self, response, i, next_sleep):
boto.log.debug(response_body)
json_response = json.loads(response_body)
if self.ThruputError in json_response.get('__type'):
print 'Throughput Throttled'
msg = "%s, retry attempt %s" % (self.ThruputError, i)
# Sleep a fractional amount of time, which corresponds
# to 1 second for our last attempt, and zero time for
# our first retry.
next_sleep = (1.0/self.num_retries)*i
next_sleep = .1*i
i += 1
status = (msg, i, next_sleep)
elif self.SessionExpiredError in json_response.get('__type'):
Expand Down

0 comments on commit c0ff68a

Please sign in to comment.