Skip to content

Commit

Permalink
Merge pull request #10 from debroys/develop
Browse files Browse the repository at this point in the history
Change reraising error to "raise" from "raise e"
  • Loading branch information
kopertop committed Aug 15, 2016
2 parents 9c855dc + d9834b6 commit e13b2e1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions botoweb/db/dynamo.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def get_table(cls):
def get_by_id(cls, hash_key, range_key=None, consistent_read=False):
'''Get this type of item by a given ID'''
attempt = 0
last_error = None
while attempt < MAX_RETRIES:
table = cls.get_table()
try:
Expand All @@ -147,17 +146,18 @@ def get_by_id(cls, hash_key, range_key=None, consistent_read=False):
log.exception('Could not retrieve item')
cls._table = None
attempt += 1
if attempt == MAX_RETRIES:
raise
time.sleep(attempt ** 2)
last_error = e
except BotoServerError, e:
log.error('Boto Server Error: %s' % e)
cls._table = None
attempt += 1
last_error = e
if attempt == MAX_RETRIES:
raise
time.sleep(attempt ** 2)

if last_error:
raise e
# Should not reach here
assert attempt < MAX_RETRIES, 'get_by_id should have raised an error after %s errors' % MAX_RETRIES

lookup = get_by_id

Expand Down

0 comments on commit e13b2e1

Please sign in to comment.