server/utils.py
branchstable
changeset 7573 c8f8762c986d
parent 6765 b922e3a817e9
child 7815 2a164a9cf81c
--- a/server/utils.py	Wed Jun 29 15:50:26 2011 +0200
+++ b/server/utils.py	Wed Jun 29 16:02:24 2011 +0200
@@ -128,14 +128,18 @@
                              (interval, func_name(func)))
         self.interval = interval
         def auto_restart_func(self=self, func=func, args=args):
+            restart = True
             try:
                 func(*args)
-            except:
+            except Exception:
                 logger = logging.getLogger('cubicweb.repository')
                 logger.exception('Unhandled exception in LoopTask %s', self.name)
                 raise
+            except BaseException:
+                restart = False
             finally:
-                self.start()
+                if restart:
+                    self.start()
         self.func = auto_restart_func
         self.name = func_name(func)