From b5353e63cd52b0d98e7a56acc5c8fbfc6ad8b3ee Mon Sep 17 00:00:00 2001 From: Maxim Devaev Date: Thu, 4 May 2023 12:37:05 +0300 Subject: python 3.11 fixes --- kvmd/aiotools.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'kvmd/aiotools.py') 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(): -- cgit v1.2.3