Skip to content

Commit ca23abd

Browse files
committed
Fix timeout retries
1 parent 7a911f3 commit ca23abd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arq/worker.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ async def job_failed(exc: BaseException) -> None:
592592
# run repr(result) and extra inside try/except as they can raise exceptions
593593
try:
594594
result = await asyncio.wait_for(task, timeout_s)
595-
except (Exception, asyncio.CancelledError) as e:
595+
except (Exception, asyncio.CancelledError, asyncio.TimeoutError) as e:
596596
exc_extra = getattr(e, 'extra', None)
597597
if callable(exc_extra):
598598
exc_extra = exc_extra()
@@ -602,7 +602,7 @@ async def job_failed(exc: BaseException) -> None:
602602
finally:
603603
del self.job_tasks[job_id]
604604

605-
except (Exception, asyncio.CancelledError) as e:
605+
except (Exception, asyncio.CancelledError, asyncio.TimeoutError) as e:
606606
finished_ms = timestamp_ms()
607607
t = (finished_ms - start_ms) / 1000
608608
if self.retry_jobs and isinstance(e, Retry):
@@ -617,7 +617,7 @@ async def job_failed(exc: BaseException) -> None:
617617
finish = True
618618
self.aborting_tasks.remove(job_id)
619619
self.jobs_failed += 1
620-
elif self.retry_jobs and isinstance(e, (asyncio.CancelledError, RetryJob)):
620+
elif self.retry_jobs and isinstance(e, (asyncio.TimeoutError, RetryJob)):
621621
logger.info('%6.2fs ↻ %s cancelled, will be run again', t, ref)
622622
self.jobs_retried += 1
623623
else:

0 commit comments

Comments
 (0)