def borgcubed_idle(apiserver):
"""Check schedule. Are we supposed to do something right about now?"""
# seconds = seconds_until_next_occurence()
# log.debug('setting alarm clock to beep in %d seconds', seconds)
# signal.alarm(seconds)
this_very_moment = now()
for schedule in data_root().schedules:
if not schedule.recurrence_enabled:
continue
# TODO: when django-recurrence#81 is resolved, use cache.
occurence = schedule.recurrence.after(this_very_moment)
if latest_executions.get(schedule._p_oid) == occurence:
continue
if occurence and abs((occurence - this_very_moment).total_seconds()) < 10:
latest_executions[schedule._p_oid] = occurence
execute(apiserver, schedule)
评论列表
文章目录