Call plugin unload function after stopping event loop (#539)

This can prevent race conditions where unload is clearing data but main is still working with it
This commit is contained in:
Jan
2023-12-16 03:07:54 +01:00
committed by AAGaming
parent 3a38cf8074
commit 5190765ce1
@@ -115,11 +115,11 @@ class SandboxedPlugin:
if "stop" in data:
self.log.info("Calling Loader unload function.")
await self._unload()
get_event_loop().stop()
while get_event_loop().is_running():
await sleep(0)
get_event_loop().close()
await self._unload()
raise Exception("Closing message listener")
d: SocketResponseDict = {"res": None, "success": True, "id": data["id"]}