server/utils.py
changeset 8911 2dd134a86996
parent 8887 7920f439f383
child 8912 da2007002dca
equal deleted inserted replaced
8907:ddeb02b02222 8911:2dd134a86996
   143     return name
   143     return name
   144 
   144 
   145 class LoopTask(object):
   145 class LoopTask(object):
   146     """threaded task restarting itself once executed"""
   146     """threaded task restarting itself once executed"""
   147     def __init__(self, tasks_manager, interval, func, args):
   147     def __init__(self, tasks_manager, interval, func, args):
   148         if interval <= 0:
   148         if interval < 0:
   149             raise ValueError('Loop task interval must be > 0 '
   149             raise ValueError('Loop task interval must be >= 0 '
   150                              '(current value: %f for %s)' % \
   150                              '(current value: %f for %s)' % \
   151                              (interval, func_name(func)))
   151                              (interval, func_name(func)))
   152         self._tasks_manager = tasks_manager
   152         self._tasks_manager = tasks_manager
   153         self.interval = interval
   153         self.interval = interval
   154         def auto_restart_func(self=self, func=func, args=args):
   154         def auto_restart_func(self=self, func=func, args=args):