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

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

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)