From 6694d5ab714cd27c88d51e2561a898718f2e8e69 Mon Sep 17 00:00:00 2001 From: tza Date: Wed, 13 Apr 2022 23:50:26 +0300 Subject: fixed passive plugin reload bug and close event loop properly --- plugin_loader/plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'plugin_loader/plugin.py') diff --git a/plugin_loader/plugin.py b/plugin_loader/plugin.py index 04feeb27..033d36fc 100644 --- a/plugin_loader/plugin.py +++ b/plugin_loader/plugin.py @@ -45,7 +45,9 @@ class PluginWrapper: while True: data = loads((await reader.readline()).decode("utf-8")) if "stop" in data: - return get_event_loop().stop() + get_event_loop().stop() + get_event_loop().close() + return d = {"res": None, "success": True} try: d["res"] = await getattr(self.Plugin, data["method"])(self.Plugin, **data["args"]) @@ -82,6 +84,7 @@ class PluginWrapper: await self._open_socket_if_not_exists() self.writer.write((dumps({"stop": True})+"\n").encode("utf-8")) await self.writer.drain() + self.writer.close() loop.create_task(_(self)) async def execute_method(self, method_name, kwargs): -- cgit v1.2.3