瀏覽代碼

Beat: ScheduleEntry._default_now added to override the default value of last_run_at

Ask Solem 14 年之前
父節點
當前提交
d41db95986
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      celery/beat.py

+ 4 - 1
celery/beat.py

@@ -73,9 +73,12 @@ class ScheduleEntry(object):
         self.args = args
         self.kwargs = kwargs
         self.options = options
-        self.last_run_at = last_run_at or datetime.now()
+        self.last_run_at = last_run_at or self._default_now()
         self.total_run_count = total_run_count or 0
 
+    def _default_now(self):
+        return datetime.now()
+
     def next(self, last_run_at=None):
         """Returns a new instance of the same class, but with
         its date and count fields updated."""