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 GitHub
parent 3489fd7d69
commit 39f4f2870b
+1 -1
View File
@@ -118,11 +118,11 @@ class PluginWrapper:
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")
# TODO there is definitely a better way to type this