Skip to content

Commit

Permalink
Beat: fixed entry._default_now() not used everywhere
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mkai authored and georgepsarakis committed Sep 3, 2017
1 parent 5f2141a commit 27a686f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion celery/beat.py
Expand Up @@ -237,7 +237,7 @@ def is_due(self, entry):
def _when(self, entry, next_time_to_run, mktime=time.mktime):
adjust = self.adjust

return (mktime(entry.schedule.now().timetuple()) +
return (mktime(entry._default_now().timetuple()) +
(adjust(next_time_to_run) or 0))

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

0 comments on commit 27a686f

Please sign in to comment.