diff options
Diffstat (limited to 'kvmd/aiotools.py')
-rw-r--r-- | kvmd/aiotools.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kvmd/aiotools.py b/kvmd/aiotools.py index c87e8268..51ad6ca8 100644 --- a/kvmd/aiotools.py +++ b/kvmd/aiotools.py @@ -202,7 +202,7 @@ async def wait_infinite() -> None: await asyncio.sleep(3600) -async def wait_first(*aws: Awaitable) -> tuple[set[asyncio.Task], set[asyncio.Task]]: +async def wait_first(*aws: (asyncio.Future | asyncio.Task)) -> tuple[set[asyncio.Task], set[asyncio.Task]]: return (await asyncio.wait(list(aws), return_when=asyncio.FIRST_COMPLETED)) @@ -242,7 +242,10 @@ class AioNotifier: await self.__queue.get() else: try: - await asyncio.wait_for(self.__queue.get(), timeout=timeout) + await asyncio.wait_for( + asyncio.ensure_future(self.__queue.get()), + timeout=timeout, + ) except asyncio.TimeoutError: return # False while not self.__queue.empty(): |