diff options
author | Maxim Devaev <[email protected]> | 2022-04-12 11:37:59 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-04-12 11:38:02 +0300 |
commit | 047d8ad760249858034d13a523b99af1bc9b6c1d (patch) | |
tree | bda759ebf694e73b8409a62d0682b3b4e75ee5bb /kvmd/htserver.py | |
parent | 6b3296c989dacecb68167e4331fc66c7e3ee89fe (diff) |
refactoring
Diffstat (limited to 'kvmd/htserver.py')
-rw-r--r-- | kvmd/htserver.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/kvmd/htserver.py b/kvmd/htserver.py index 1d86ba16..c24837d2 100644 --- a/kvmd/htserver.py +++ b/kvmd/htserver.py @@ -325,14 +325,14 @@ class HttpServer: async def _check_request_auth(self, exposed: HttpExposed, request: Request) -> None: pass - async def _init_app(self, app: Application) -> None: + async def _init_app(self) -> None: raise NotImplementedError - async def _on_shutdown(self, app: Application) -> None: - _ = app + async def _on_shutdown(self) -> None: + pass - async def _on_cleanup(self, app: Application) -> None: - _ = app + async def _on_cleanup(self) -> None: + pass # ===== @@ -342,9 +342,16 @@ class HttpServer: remove_slash=True, merge_slashes=True, )]) - self.__app.on_shutdown.append(self._on_shutdown) - self.__app.on_cleanup.append(self._on_cleanup) - await self._init_app(self.__app) + + async def on_shutdown(_: Application) -> None: + await self._on_shutdown() + self.__app.on_shutdown.append(on_shutdown) + + async def on_cleanup(_: Application) -> None: + await self._on_cleanup() + self.__app.on_cleanup.append(on_cleanup) + + await self._init_app() return self.__app def __run_app_print(self, text: str) -> None: |