summaryrefslogtreecommitdiff
path: root/kvmd/aiotools.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-08-07 19:04:32 +0300
committerMaxim Devaev <[email protected]>2022-08-07 19:04:32 +0300
commitec9785b4be4afb8667e6968a0454aeca62a190e2 (patch)
tree0b5c7d1b03041867c78f5533a8dd8f488711b073 /kvmd/aiotools.py
parentaa630988cc09f31d412a62c5480d4bec1a7c626e (diff)
simplified AioNotifier()
Diffstat (limited to 'kvmd/aiotools.py')
-rw-r--r--kvmd/aiotools.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/kvmd/aiotools.py b/kvmd/aiotools.py
index 2a798e2a..07981fde 100644
--- a/kvmd/aiotools.py
+++ b/kvmd/aiotools.py
@@ -232,10 +232,7 @@ class AioNotifier:
def __init__(self) -> None:
self.__queue: "asyncio.Queue[None]" = asyncio.Queue()
- async def notify(self) -> None:
- await self.__queue.put(None)
-
- def notify_sync(self) -> None:
+ def notify(self) -> None:
self.__queue.put_nowait(None)
async def wait(self, timeout: Optional[float]=None) -> None:
@@ -299,7 +296,7 @@ class AioExclusiveRegion:
self.__busy = True
try:
if self.__notifier:
- await self.__notifier.notify()
+ self.__notifier.notify()
except: # noqa: E722
self.__busy = False
raise
@@ -309,7 +306,7 @@ class AioExclusiveRegion:
async def exit(self) -> None:
self.__busy = False
if self.__notifier:
- await self.__notifier.notify()
+ self.__notifier.notify()
async def __aenter__(self) -> None:
await self.enter()