lock before gathering meta tasks

This commit is contained in:
Daniil Fajnberg 2022-03-30 11:47:15 +02:00
parent 17539e9c27
commit 153127e028
Signed by: daniil-berg
GPG Key ID: BE187C50903BEE97

View File

@ -607,6 +607,7 @@ class TaskPool(BaseTaskPool):
Raises:
`PoolStillUnlocked`: The pool has not been locked yet.
"""
self.lock()
not_cancelled_meta_tasks = (task for task_set in self._group_meta_tasks_running.values() for task in task_set)
with suppress(CancelledError):
await gather(*self._meta_tasks_cancelled, *not_cancelled_meta_tasks, return_exceptions=return_exceptions)