Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
sepereated CancelledError from normal Exception in retry decorator
  • Loading branch information
malkaed committed May 27, 2022
commit 72fe8b0dd23d5138027f3235ca362a439a9fc156
5 changes: 4 additions & 1 deletion temporal/retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ async def retry_loop(*args, **kwargs):
await fp(*args, **kwargs)
logger.debug("@retry decorated function %s exited, ending retry loop", fp.__name__)
break
except (Exception, asyncio.CancelledError) as ex:
except asyncio.CancelledError as ex:
logger.info("%s raised CancelledError, retrying...", fp.__name__)
await asyncio.sleep(INITIAL_DELAY_SECONDS)
except Exception as ex:
now = calendar.timegm(time.gmtime())
if last_failed_time == -1 or (now - last_failed_time) > RESET_DELAY_AFTER_SECONDS:
delay_seconds = INITIAL_DELAY_SECONDS
Expand Down