diff options
author | Maxim Devaev <[email protected]> | 2022-06-19 19:54:24 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-06-19 20:25:52 +0300 |
commit | 4aa7a21b5597af3171ff5b7217fe4e6bb3ab5db9 (patch) | |
tree | 059b68ccfdbab546604c4b75278b56a2469c0f4a | |
parent | 17865348f2be19dc2641562a5c7363e7f6e11bfc (diff) |
better logging
-rw-r--r-- | kvmd/apps/pst/server.py | 11 | ||||
-rw-r--r-- | kvmd/helpers/remount/__init__.py | 1 |
2 files changed, 7 insertions, 5 deletions
diff --git a/kvmd/apps/pst/server.py b/kvmd/apps/pst/server.py index 0d174595..38c7d8ff 100644 --- a/kvmd/apps/pst/server.py +++ b/kvmd/apps/pst/server.py @@ -75,8 +75,8 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst # ===== SYSTEM STUFF async def _init_app(self) -> None: - if (await self.__remount_storage(True)): - await self.__remount_storage(False) + if (await self.__remount_storage(rw=True)): + await self.__remount_storage(rw=False) aiotools.create_deadly_task("Controller", self.__controller()) self._add_exposed(self) @@ -92,7 +92,7 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst async def _on_cleanup(self) -> None: logger = get_logger(0) - await self.__remount_storage(False) + await self.__remount_storage(rw=False) logger.info("On-Cleanup complete") async def _on_ws_opened(self) -> None: @@ -104,14 +104,15 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst # ===== SYSTEM TASKS async def __controller(self) -> None: + logger = get_logger(0) prev: int = 0 while True: cur = len(self._get_wss()) if cur > 0: if not self.__is_write_available(): - await self.__remount_storage(True) + await self.__remount_storage(rw=True) elif prev > 0 and cur == 0: - while not (await self.__remount_storage(False)): + while not (await self.__remount_storage(rw=False)): if len(self._get_wss()) > 0: continue await asyncio.sleep(self.__ro_retries_delay) diff --git a/kvmd/helpers/remount/__init__.py b/kvmd/helpers/remount/__init__.py index 5c833a39..9ea2889d 100644 --- a/kvmd/helpers/remount/__init__.py +++ b/kvmd/helpers/remount/__init__.py @@ -119,3 +119,4 @@ def main() -> None: _mkdir(path) if storage.user: _chown(path, storage.user) + _log(f"Storage in the {'RW' if rw else 'RO'}-mode now") |