Browse Source

Save conversion of run_every from int to timedelta to the class attribute
instead of on the instance.

Ask Solem 15 years ago
parent
commit
e19b4d9d30
1 changed files with 4 additions and 2 deletions
  1. 4 2
      celery/task/base.py

+ 4 - 2
celery/task/base.py

@@ -550,7 +550,9 @@ class PeriodicTask(Task):
                     "Periodic tasks must have a run_every attribute")
 
         # If run_every is a integer, convert it to timedelta seconds.
-        if isinstance(self.run_every, int):
-            self.run_every = timedelta(seconds=self.run_every)
+        # Operate on the original class attribute so anyone accessing
+        # it directly gets the right value.
+        if isinstance(self.__class__.run_every, int):
+            self.__class__.run_every = timedelta(seconds=self.run_every)
 
         super(PeriodicTask, self).__init__()