From 7314b5ecae77c2331cf49063771c6ce8cea96c6a Mon Sep 17 00:00:00 2001 From: Ruud Date: Sat, 11 May 2013 00:04:59 +0200 Subject: [PATCH] Run async event in thread so the on_complete is fired properly --- couchpotato/core/event.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/couchpotato/core/event.py b/couchpotato/core/event.py index 2f872a6a..1fd6ab25 100644 --- a/couchpotato/core/event.py +++ b/couchpotato/core/event.py @@ -139,8 +139,13 @@ def fireEvent(name, *args, **kwargs): log.error('%s: %s', (name, traceback.format_exc())) def fireEventAsync(*args, **kwargs): - kwargs['async'] = True - fireEvent(*args, **kwargs) + try: + t = threading.Thread(target = fireEvent, args = args, kwargs = kwargs) + t.setDaemon(True) + t.start() + return True + except Exception, e: + log.error('%s: %s', (args[0], e)) def errorHandler(error): etype, value, tb = error