implement a shutdown routine instead of just waiting for all plugins to stop on their own

This commit is contained in:
AAGaming
2024-07-03 20:08:30 -04:00
parent b32fa7948f
commit 2c4edeb810
8 changed files with 121 additions and 22 deletions
+5 -1
View File
@@ -2,7 +2,7 @@ from logging import getLogger
from asyncio import AbstractEventLoop, create_task
from aiohttp import WSMsgType, WSMessage
from aiohttp import WSCloseCode, WSMsgType, WSMessage
from aiohttp.web import Application, WebSocketResponse, Request, Response, get
from enum import IntEnum
@@ -133,3 +133,7 @@ class WSRouter:
async def emit(self, event: str, *args: Any):
self.logger.debug(f'Firing frontend event {event} with args {args}')
await self.write({ "type": MessageType.EVENT.value, "event": event, "args": args })
async def disconnect(self):
if self.ws:
await self.ws.close(code=WSCloseCode.GOING_AWAY, message=b"Loader is shutting down")