diff options
author | Maxim Devaev <[email protected]> | 2023-05-04 12:37:05 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2023-05-04 12:37:05 +0300 |
commit | b5353e63cd52b0d98e7a56acc5c8fbfc6ad8b3ee (patch) | |
tree | 3176f1a738b9533e6f3a28b132e4501a6f97f991 /kvmd/aiotools.py | |
parent | b5d67314977a7e475fac164446031ca7c83b8bc4 (diff) |
python 3.11 fixes
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(): |