Skip to content

Commit ab6efd0

Browse files
committed
[tasks] Log handled exceptions before sleeping
Fix Rapptz#10276
1 parent d00ac62 commit ab6efd0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

discord/ext/tasks/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,14 @@ async def _loop(self, *args: Any, **kwargs: Any) -> None:
249249
self._last_iteration_failed = True
250250
if not self.reconnect:
251251
raise
252-
await asyncio.sleep(backoff.delay())
252+
253+
retry_after = backoff.delay()
254+
_log.exception(
255+
'Handling exception in internal background task %s. Retrying in %.2fs',
256+
self.coro.__qualname__,
257+
retry_after,
258+
)
259+
await asyncio.sleep(retry_after)
253260
else:
254261
if self._stop_next_iteration:
255262
return

0 commit comments

Comments
 (0)