File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
packages/common-library/src/common_library Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -92,10 +92,11 @@ async def cancel_wait_task(
9292
9393 cancelling = task .cancel ()
9494 if not cancelling :
95- return # task was alredy cancelled
95+ return # task could not be cancelled (either already done or something else)
9696
9797 assert task .cancelling () # nosec
9898 assert not task .cancelled () # nosec
99+ assert not task .done () # nosec
99100
100101 try :
101102
@@ -106,8 +107,9 @@ async def cancel_wait_task(
106107 )
107108
108109 except asyncio .CancelledError :
109- if not task .cancelled ():
110- # task owner function is being cancelled -> propagate cancellation
110+ assert task .done () # nosec
111+ if asyncio .current_task ().cancelling () > 0 :
112+ # owner function is being cancelled -> propagate cancellation
111113 raise
112114
113115 # else: task cancellation is complete, we can safely ignore it
You can’t perform that action at this time.
0 commit comments