diff options
author | Devaev Maxim <[email protected]> | 2020-09-08 05:24:47 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-08 05:24:47 +0300 |
commit | 605b67ca761bdb5f5c3b255434f30624fa82a6c1 (patch) | |
tree | d7821a55ca5ec9e2da6b75bf2956dea6345de1a1 /kvmd/apps | |
parent | 4cc60e4d528c669af0c1f7478160ff57a4691af7 (diff) |
refactoring
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/kvmd/streamer.py | 8 | ||||
-rw-r--r-- | kvmd/apps/kvmd/ugpio.py | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py index 6b2d597a..f9fffc16 100644 --- a/kvmd/apps/kvmd/streamer.py +++ b/kvmd/apps/kvmd/streamer.py @@ -172,7 +172,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes self.__snapshot: Optional[StreamerSnapshot] = None - self.__state_notifier = aiotools.AioNotifier() + self.__notifier = aiotools.AioNotifier() # ===== @@ -277,7 +277,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes async def poll_state(self) -> AsyncGenerator[Dict, None]: def signal_handler(*_: Any) -> None: get_logger(0).info("Got SIGUSR2, checking the stream state ...") - asyncio.ensure_future(self.__state_notifier.notify()) + asyncio.ensure_future(self.__notifier.notify()) get_logger(0).info("Installing SIGUSR2 streamer handler ...") asyncio.get_event_loop().add_signal_handler(signal.SIGUSR2, signal_handler) @@ -291,7 +291,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes prev_state = state if waiter_task is None: - waiter_task = asyncio.create_task(self.__state_notifier.wait()) + waiter_task = asyncio.create_task(self.__notifier.wait()) if waiter_task in (await aiotools.wait_first(asyncio.sleep(self.__state_poll), waiter_task))[0]: waiter_task = None @@ -328,7 +328,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes ) if save: self.__snapshot = snapshot - await self.__state_notifier.notify() + await self.__notifier.notify() return snapshot logger.error("Stream is offline, no signal or so") except (aiohttp.ClientConnectionError, aiohttp.ServerConnectionError) as err: diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py index 8e7ae90a..ab034365 100644 --- a/kvmd/apps/kvmd/ugpio.py +++ b/kvmd/apps/kvmd/ugpio.py @@ -215,12 +215,12 @@ class UserGpio: def __init__(self, config: Section) -> None: self.__view = config.view - self.__state_notifier = aiotools.AioNotifier() + self.__notifier = aiotools.AioNotifier() self.__drivers = { driver: get_ugpio_driver_class(drv_config.type)( instance_name=driver, - notifier=self.__state_notifier, + notifier=self.__notifier, **drv_config._unpack(ignore=["instance_name", "notifier", "type"]), ) for (driver, drv_config) in config.drivers.items() @@ -236,7 +236,7 @@ class UserGpio: if ch_config.mode == "input": self.__inputs[channel] = _GpioInput(channel, ch_config, driver) else: # output: - self.__outputs[channel] = _GpioOutput(channel, ch_config, driver, self.__state_notifier) + self.__outputs[channel] = _GpioOutput(channel, ch_config, driver, self.__notifier) async def get_model(self) -> Dict: return { @@ -260,7 +260,7 @@ class UserGpio: if state != prev_state: yield state prev_state = state - await self.__state_notifier.wait() + await self.__notifier.wait() def sysprep(self) -> None: get_logger().info("Preparing User-GPIO drivers ...") |