fix: plugin events dispatch is now asynchronous (fixes #592)

This commit is contained in:
Simone Margaritelli committed 2019-11-13 00:11:50 +01:00
1 parent a5f9b9b2ee
commit 8fcfd4cafd
2 files changed
+7 -6

No files matched your search

+2 -1
View File
@@ -1,5 +1,6 @@
import os
import glob
import _thread
import importlib, importlib.util
import logging
@@ -31,7 +32,7 @@ def one(plugin_name, event_name, *args, **kwargs):
callback = getattr(plugin, cb_name, None)
if callback is not None and callable(callback):
try:
callback(*args, **kwargs)
_thread.start_new_thread(callback, (*args, *kwargs))
except Exception as e:
logging.error("error while running %s.%s : %s" % (plugin_name, cb_name, e))
logging.error(e, exc_info=True)