Fix deadlock when stopping queued script (#68175)
This commit is contained in:
parent
cdd23abea7
commit
8ea31cea3a
2 changed files with 34 additions and 2 deletions
|
@ -860,12 +860,13 @@ class _QueuedScriptRun(_ScriptRun):
|
|||
{lock_task, stop_task}, return_when=asyncio.FIRST_COMPLETED
|
||||
)
|
||||
except asyncio.CancelledError:
|
||||
lock_task.cancel()
|
||||
self._finish()
|
||||
raise
|
||||
else:
|
||||
self.lock_acquired = lock_task.done() and not lock_task.cancelled()
|
||||
finally:
|
||||
lock_task.cancel()
|
||||
stop_task.cancel()
|
||||
self.lock_acquired = lock_task.done() and not lock_task.cancelled()
|
||||
|
||||
# If we've been told to stop, then just finish up. Otherwise, we've acquired the
|
||||
# lock so we can go ahead and start the run.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue