Procházet zdrojové kódy

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

Ask Solem před 14 roky
rodič
revize
d41db95986
1 změnil soubory, kde provedl 4 přidání a 1 odebrání
  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."""