diff options
Diffstat (limited to 'kvmd/tools.py')
-rw-r--r-- | kvmd/tools.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/tools.py b/kvmd/tools.py index 14a58ab3..6dd7d2f9 100644 --- a/kvmd/tools.py +++ b/kvmd/tools.py @@ -20,6 +20,7 @@ # ========================================================================== # +import asyncio import operator import functools import multiprocessing.queues @@ -64,11 +65,11 @@ def swapped_kvs(dct: dict[_DictKeyT, _DictValueT]) -> dict[_DictValueT, _DictKey # ===== -def clear_queue(q: multiprocessing.queues.Queue) -> None: # pylint: disable=invalid-name +def clear_queue(q: (multiprocessing.queues.Queue | asyncio.Queue)) -> None: # pylint: disable=invalid-name for _ in range(q.qsize()): try: q.get_nowait() - except queue.Empty: + except (queue.Empty, asyncio.QueueEmpty): break |