Skip to content

Commit 27a686f

Browse files
mkaigeorgepsarakis
authored andcommitted
Beat: fixed entry._default_now() not used everywhere
I'm using custom scheduler entries with an overridden ``is_due()`` method that do not require a schedule (``entry.schedule``) to be set. Judging from the ``entry._default_now()`` method, this seems to be supported by the scheduler in Celery 4.1.0, however that method is not used everywhere, leading to an AttributeError in my use case. This change just uses ``_default_now()`` everywhere which fixes the issue. It shouldn't have any impact on the default implementation.
1 parent 5f2141a commit 27a686f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

celery/beat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def is_due(self, entry):
237237
def _when(self, entry, next_time_to_run, mktime=time.mktime):
238238
adjust = self.adjust
239239

240-
return (mktime(entry.schedule.now().timetuple()) +
240+
return (mktime(entry._default_now().timetuple()) +
241241
(adjust(next_time_to_run) or 0))
242242

243243
def populate_heap(self, event_t=event_t, heapify=heapq.heapify):

0 commit comments

Comments
 (0)