mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
fixed long shutdown
This commit is contained in:
parent
25c9c63788
commit
365f06a2e8
@ -240,6 +240,7 @@ class HttpServer:
|
||||
|
||||
aiohttp.web.run_app(
|
||||
app=self._make_app(),
|
||||
shutdown_timeout=1,
|
||||
access_log_format=access_log_format,
|
||||
print=self.__run_app_print,
|
||||
**socket_kwargs,
|
||||
|
||||
@ -367,6 +367,8 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
|
||||
for client in list(self.__ws_clients):
|
||||
await self.__remove_ws_client(client)
|
||||
|
||||
logger.info("On-Shutdown complete")
|
||||
|
||||
async def __on_cleanup(self, _: aiohttp.web.Application) -> None:
|
||||
logger = get_logger(0)
|
||||
for component in self.__components:
|
||||
@ -376,6 +378,7 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
|
||||
await component.cleanup() # type: ignore
|
||||
except Exception:
|
||||
logger.exception("Cleanup error on %s", component.name)
|
||||
logger.info("On-Cleanup complete")
|
||||
|
||||
async def __send_event(self, ws: aiohttp.web.WebSocketResponse, event_type: str, event: Optional[Dict]) -> None:
|
||||
await ws.send_str(json.dumps({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user