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
+4 -1
View File
@@ -1,5 +1,5 @@
from __future__ import annotations
from asyncio import AbstractEventLoop, Queue, sleep
from asyncio import AbstractEventLoop, Queue, gather, sleep
from logging import getLogger
from os import listdir, path
from pathlib import Path
@@ -98,6 +98,9 @@ class Loader:
server_instance.ws.add_route("loader/call_plugin_method", self.handle_plugin_method_call)
server_instance.ws.add_route("loader/call_legacy_plugin_method", self.handle_plugin_method_call_legacy)
async def shutdown_plugins(self):
await gather(*[self.plugins[plugin_name].stop() for plugin_name in self.plugins])
async def enable_reload_wait(self):
if self.live_reload:
await sleep(10)