summaryrefslogtreecommitdiff
path: root/kvmd/apps
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2022-08-07 19:35:08 +0300
committerMaxim Devaev <[email protected]>2022-08-07 19:35:08 +0300
commite37a7254d5cf7e4cfa5dcfbbaf5b0e9d7474d154 (patch)
treec25210abfceb0da0725798105a389c5598694ff7 /kvmd/apps
parentfdc3edfa799b21f04a83676459bab7a4e67b056f (diff)
using shield_fg() in atomic (now atomic_fg)
Diffstat (limited to 'kvmd/apps')
-rw-r--r--kvmd/apps/janus/runner.py4
-rw-r--r--kvmd/apps/kvmd/auth.py2
-rw-r--r--kvmd/apps/kvmd/streamer.py10
-rw-r--r--kvmd/apps/kvmd/ugpio.py10
4 files changed, 13 insertions, 13 deletions
diff --git a/kvmd/apps/janus/runner.py b/kvmd/apps/janus/runner.py
index 204f8a9e..799fd94c 100644
--- a/kvmd/apps/janus/runner.py
+++ b/kvmd/apps/janus/runner.py
@@ -126,13 +126,13 @@ class JanusRunner: # pylint: disable=too-many-instance-attributes
# =====
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __start_janus(self, netcfg: _Netcfg) -> None:
get_logger(0).info("Starting Janus ...")
assert not self.__janus_task
self.__janus_task = asyncio.create_task(self.__janus_task_loop(netcfg))
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __stop_janus(self) -> None:
if self.__janus_task:
get_logger(0).info("Stopping Janus ...")
diff --git a/kvmd/apps/kvmd/auth.py b/kvmd/apps/kvmd/auth.py
index 8bd2286d..0f437a6b 100644
--- a/kvmd/apps/kvmd/auth.py
+++ b/kvmd/apps/kvmd/auth.py
@@ -113,7 +113,7 @@ class AuthManager:
assert self.__enabled
return self.__tokens.get(token)
- @aiotools.atomic
+ @aiotools.atomic_fg
async def cleanup(self) -> None:
if self.__enabled:
assert self.__internal_service
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py
index cc753aff..fb209033 100644
--- a/kvmd/apps/kvmd/streamer.py
+++ b/kvmd/apps/kvmd/streamer.py
@@ -221,7 +221,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
# =====
- @aiotools.atomic
+ @aiotools.atomic_fg
async def ensure_start(self, reset: bool) -> None:
if not self.__streamer_task or self.__stop_task:
logger = get_logger(0)
@@ -241,7 +241,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
logger.info("Starting streamer ...")
await self.__inner_start()
- @aiotools.atomic
+ @aiotools.atomic_fg
async def ensure_stop(self, immediately: bool) -> None:
if self.__streamer_task:
logger = get_logger(0)
@@ -384,7 +384,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
# =====
- @aiotools.atomic
+ @aiotools.atomic_fg
async def cleanup(self) -> None:
await self.ensure_stop(immediately=True)
if self.__http_session:
@@ -409,12 +409,12 @@ class Streamer: # pylint: disable=too-many-instance-attributes
# =====
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __inner_start(self) -> None:
assert not self.__streamer_task
self.__streamer_task = asyncio.create_task(self.__streamer_task_loop())
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __inner_stop(self) -> None:
assert self.__streamer_task
self.__streamer_task.cancel()
diff --git a/kvmd/apps/kvmd/ugpio.py b/kvmd/apps/kvmd/ugpio.py
index d4b0f16a..b29b7ce4 100644
--- a/kvmd/apps/kvmd/ugpio.py
+++ b/kvmd/apps/kvmd/ugpio.py
@@ -172,7 +172,7 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
raise GpioSwitchNotSupported()
await self.__run_action(wait, "switch", self.__inner_switch, state)
- @aiotools.atomic
+ @aiotools.atomic_fg
async def pulse(self, delay: float, wait: bool) -> None:
if not self.__pulse_delay:
raise GpioPulseNotSupported()
@@ -181,7 +181,7 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
# =====
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __run_action(self, wait: bool, name: str, func: Callable, *args: Any) -> None:
if wait:
async with self.__region:
@@ -192,20 +192,20 @@ class _GpioOutput: # pylint: disable=too-many-instance-attributes
self.__region, self.__action_task_wrapper, name, func, *args,
)
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __action_task_wrapper(self, name: str, func: Callable, *args: Any) -> None:
try:
return (await func(*args))
except GpioDriverOfflineError:
get_logger(0).error("Can't perform %s of %s or operation was not completed: driver offline", name, self)
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __inner_switch(self, state: bool) -> None:
await self.__write(state)
get_logger(0).info("Ensured switch %s to state=%d", self, state)
await asyncio.sleep(self.__busy_delay)
- @aiotools.atomic
+ @aiotools.atomic_fg
async def __inner_pulse(self, delay: float) -> None:
try:
await self.__write(True)