Skip to content

Commit

Permalink
fix(taskqueue): ensure retryable tasks can not return null
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKevJames committed Jan 24, 2018
1 parent 3aaf003 commit 1c49e54
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions taskqueue/gcloud/aio/taskqueue/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,14 @@ async def raise_for_status(resp):
async def retry(coro, exceptions=None, retries=3):
for attempt in range(retries):
try:
return await coro
resp = await coro
if resp is not None:
return resp
except Exception as e: # pylint: disable=broad-except
if exceptions is not None and e not in exceptions:
raise
if attempt >= retries - 1:
raise
log.warning('retrying due to %s', e)

raise aiohttp.client_exceptions.ClientResponseError(
None, None, code=429, message='hit retry limit ({})'.format(retries))
raise Exception('hit retry limit ({})'.format(retries))

0 comments on commit 1c49e54

Please sign in to comment.