Skip to content

Commit 71b76c8

Browse files
authored
Improve Shutdown Logging (#610)
Don't attempt to journal an asyncio `CancelledError`, just reraise it. This cleans up the shutdown procedure and avoids logging many spurious errors.
1 parent 1400ba5 commit 71b76c8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dbos/_outcome.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
from dbos._context import EnterDBOSStepRetry
1818
from dbos._error import DBOSException
19+
from dbos._logger import dbos_logger
1920
from dbos._registrations import get_dbos_func_name
2021

2122
if TYPE_CHECKING:
@@ -184,6 +185,9 @@ async def _wrap(
184185
try:
185186
value = await func()
186187
return await asyncio.to_thread(after, lambda: value)
188+
except asyncio.CancelledError:
189+
dbos_logger.warning(f"Asyncio task cancelled for workflow or step {func}")
190+
raise
187191
except BaseException as exp:
188192
return await asyncio.to_thread(after, lambda: Pending._raise(exp))
189193

0 commit comments

Comments
 (0)