From 04ff580075e243a81558d4a3ee9014e4ec7606ca Mon Sep 17 00:00:00 2001 From: Unbit Date: Tue, 19 Feb 2013 07:12:44 +0100 Subject: [PATCH] improved muleloop in uwsgidecoraotors --- uwsgidecorators.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/uwsgidecorators.py b/uwsgidecorators.py index 89c1cc98..15b11cd8 100644 --- a/uwsgidecorators.py +++ b/uwsgidecorators.py @@ -1,4 +1,5 @@ import uwsgi +import sys from threading import Thread try: @@ -170,7 +171,12 @@ class mule_brain(object): def __call__(self): if uwsgi.mule_id() == self.num: - self.f() + try: + self.f() + except: + exc = sys.exc_info() + sys.excepthook(exc[0], exc[1], exc[2]) + sys.exit(1) class mule_brainloop(mule_brain): @@ -178,7 +184,12 @@ class mule_brainloop(mule_brain): def __call__(self): if uwsgi.mule_id() == self.num: while True: - self.f() + try: + self.f() + except: + exc = sys.exc_info() + sys.excepthook(exc[0], exc[1], exc[2]) + sys.exit(1) class mule(object):