Skip to content
Browse files

Tweaking the throughput throttling exception handling for Amazon Dyna…

…moDB module.
  • Loading branch information...
1 parent 8167916 commit c0ff68abc660f9f80d098db619a6d68f6f57e6a6 @garnaat garnaat committed Jan 31, 2012
Showing with 3 additions and 4 deletions.
  1. +1 −0 boto/connection.py
  2. +2 −4 boto/dynamodb/layer1.py
View
1 boto/connection.py
@@ -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
View
6 boto/dynamodb/layer1.py
@@ -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'):

0 comments on commit c0ff68a

Please sign in to comment.
Something went wrong with that request. Please try again.