From 4b8891f7a47bf6de1e245364825cd7c277a74151 Mon Sep 17 00:00:00 2001 From: azawlocki Date: Thu, 27 May 2021 15:28:32 +0200 Subject: [PATCH] Close the work queue on Executor shutdown --- yapapi/executor/__init__.py | 3 +++ yapapi/executor/_smartq.py | 1 + 2 files changed, 4 insertions(+) diff --git a/yapapi/executor/__init__.py b/yapapi/executor/__init__.py index 13b4e721c..302d4d0c0 100644 --- a/yapapi/executor/__init__.py +++ b/yapapi/executor/__init__.py @@ -1113,6 +1113,9 @@ async def worker_starter() -> None: cancelled = True finally: + + await work_queue.close() + # Importing this at the beginning would cause circular dependencies from ..log import pluralize diff --git a/yapapi/executor/_smartq.py b/yapapi/executor/_smartq.py index 0ba96fe53..52e671c07 100644 --- a/yapapi/executor/_smartq.py +++ b/yapapi/executor/_smartq.py @@ -93,6 +93,7 @@ async def close(self): if self._buffer_task: self._buffer_task.cancel() await self._buffer_task + self._buffer_task = None def finished(self): return (