本文整理汇总了Python中celery.beat.Scheduler.maybe_due方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.maybe_due方法的具体用法?Python Scheduler.maybe_due怎么用?Python Scheduler.maybe_due使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类celery.beat.Scheduler
的用法示例。
在下文中一共展示了Scheduler.maybe_due方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: maybe_due
# 需要导入模块: from celery.beat import Scheduler [as 别名]
# 或者: from celery.beat.Scheduler import maybe_due [as 别名]
def maybe_due(self, entry, publisher=None):
is_due, next_time_to_run = entry.is_due()
if not is_due:
return next_time_to_run
lock = self._lock(entry.name)
if not lock:
return next_time_to_run
try:
# Now that we have the lock, double-check the timestamps on the
# entry before executing it.
entry = self._schedule.sync(entry.name)
if entry is None:
return next_time_to_run
is_due, next_time_to_run = entry.is_due()
if not is_due:
return next_time_to_run
return Scheduler.maybe_due(self, entry, publisher)
finally:
self._unlock(lock)