diff options
author | Maxim Devaev <[email protected]> | 2022-06-19 04:10:42 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-06-19 04:10:42 +0300 |
commit | 805ff9dd5f43d32caead051c2ff18b72be0672c9 (patch) | |
tree | d7d961344f04961141d8234ff5a6c6392f0b4657 /kvmd/apps | |
parent | 74e81b6e0345f37695c6cb05dd4fa2e489fd9026 (diff) |
ro_cleanup_delay
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/__init__.py | 1 | ||||
-rw-r--r-- | kvmd/apps/pst/server.py | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 89907437..92577a93 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -497,6 +497,7 @@ def _get_config_scheme() -> Dict: "storage": Option("/var/lib/kvmd/pst", type=valid_abs_dir, unpack_as="storage_path"), "ro_retries_delay": Option(10.0, type=valid_float_f01), + "ro_cleanup_delay": Option(3.0, type=valid_float_f01), "remount_cmd": Option([ "/usr/bin/sudo", "--non-interactive", diff --git a/kvmd/apps/pst/server.py b/kvmd/apps/pst/server.py index 84a62bda..43086249 100644 --- a/kvmd/apps/pst/server.py +++ b/kvmd/apps/pst/server.py @@ -46,6 +46,7 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst self, storage_path: str, ro_retries_delay: float, + ro_cleanup_delay: float, remount_cmd: List[str], ) -> None: @@ -53,6 +54,7 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst self.__data_path = os.path.join(storage_path, "data") self.__ro_retries_delay = ro_retries_delay + self.__ro_cleanup_delay = ro_cleanup_delay self.__remount_cmd = remount_cmd self.__notifier = aiotools.AioNotifier() @@ -83,7 +85,8 @@ class PstServer(HttpServer): # pylint: disable=too-many-arguments,too-many-inst await aiotools.stop_all_deadly_tasks() logger.info("Disconnecting clients ...") await self.__broadcast_storage_state(False) - await self._close_all_wss() + if (await self._close_all_wss()): + await asyncio.sleep(self.__ro_cleanup_delay) logger.info("On-Shutdown complete") async def _on_cleanup(self) -> None: |