INNER CODE UNIT · Python
pre_push_deferral
bunkerity/bunkerweb · src/scheduler/main.py:848
def pre_push_deferral(pushed: bool, deferrals: int) -> Tuple[bool, int]:
"""Decide whether to hold the once-jobs back for another attempt, and count the deferral.
Returns (defer, deferrals). Holding them back is not free: SCHEDULER.reload() is the only path
that reaches JobScheduler.setup(), so for as long as it is skipped no periodic job is registered
at all, and a configuration check that fails because a job has not yet produced the file it needs
would deadlock the two against each other. The deferral is therefore bounded and then gives way,
which costs one round of jobs running against a configuration nothing took and buys back a
scheduler that cannot be stuck with an empty schedule.
"""
if pushed or deferrals >= PRE_PUSH_MAX_DEFERRALS:
return False, 0
return True, deferrals + 1
def custom_configs_save_failed(err: str) -> bool:
"""Whether save_custom_configs refused the write, as opposed to reporting on it.