From 2e53fb217a0e870359b48a1f2324f3f5cf30d7ec Mon Sep 17 00:00:00 2001 From: TrainDoctor Date: Sun, 29 Jan 2023 13:32:58 -0800 Subject: Add better handling for unloading of plugins --- backend/plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backend/plugin.py') diff --git a/backend/plugin.py b/backend/plugin.py index df0efe16..883f86f4 100644 --- a/backend/plugin.py +++ b/backend/plugin.py @@ -92,9 +92,12 @@ class PluginWrapper: async def _unload(self): try: - self.log.info("Attempting to unload " + self.name + "\n") + self.log.info("Attempting to unload with plugin " + self.name + "'s \"_unload function/\"" + "\n") if hasattr(self.Plugin, "_unload"): await self.Plugin._unload(self.Plugin) + self.log.info("Unloaded " + self.name + "\n") + else: + self.log.info("Could not find \"_unload\" in " + self.name + "'s main.py" + "\n") except: self.log.error("Failed to unload " + self.name + "!\n" + format_exc()) exit(0) @@ -118,6 +121,7 @@ class PluginWrapper: break data = loads(line.decode("utf-8")) if "stop" in data: + self.log.info("Calling Loader unload function.") await self._unload() get_event_loop().stop() while get_event_loop().is_running(): -- cgit v1.2.3