[task] allow interval=0 for looping tasks
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Wed, 24 Apr 2013 11:58:49 +0200
changeset 8911 2dd134a86996
parent 8907 ddeb02b02222
child 8912 da2007002dca
[task] allow interval=0 for looping tasks There is valid usecase for perpetual running task.
doc/3.17.rst
server/utils.py
--- a/doc/3.17.rst	Tue Apr 23 18:15:10 2013 +0200
+++ b/doc/3.17.rst	Wed Apr 24 11:58:49 2013 +0200
@@ -32,6 +32,8 @@
   ``ActualNotificationOp`` the new operation use the more efficient *data*
   idiom.
 
+* Looping task can now have a ``0`` interval.
+
 
 Deprecation
 ---------------------
--- a/server/utils.py	Tue Apr 23 18:15:10 2013 +0200
+++ b/server/utils.py	Wed Apr 24 11:58:49 2013 +0200
@@ -145,8 +145,8 @@
 class LoopTask(object):
     """threaded task restarting itself once executed"""
     def __init__(self, tasks_manager, interval, func, args):
-        if interval <= 0:
-            raise ValueError('Loop task interval must be > 0 '
+        if interval < 0:
+            raise ValueError('Loop task interval must be >= 0 '
                              '(current value: %f for %s)' % \
                              (interval, func_name(func)))
         self._tasks_manager = tasks_manager