Permalink
Browse files

Final adjustment to the retry timing for throttling exceptions.

  • Loading branch information...
1 parent c0ff68a commit fed5f3632b69c470c9f04953d8320333f43a7141 @garnaat garnaat committed Jan 31, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 boto/dynamodb/layer1.py
View
6 boto/dynamodb/layer1.py
@@ -112,6 +112,7 @@ def make_request(self, action, body='', object_hook=None):
http_request = self.build_base_http_request('POST', '/', '/',
{}, headers, body, None)
response = self._mexe(http_request, sender=None,
+ override_num_retries=10,
retry_handler=self._retry_handler)
response_body = response.read()
boto.log.debug(response_body)
@@ -126,7 +127,10 @@ def _retry_handler(self, response, i, next_sleep):
if self.ThruputError in json_response.get('__type'):
print 'Throughput Throttled'
msg = "%s, retry attempt %s" % (self.ThruputError, i)
- next_sleep = .1*i
+ if i == 0:
+ next_sleep = 0
+ else:
+ next_sleep = 0.05 * (2**i)
i += 1
status = (msg, i, next_sleep)
elif self.SessionExpiredError in json_response.get('__type'):

0 comments on commit fed5f36

Please sign in to comment.