INNER CODE UNIT · Python

generate_configs_for_jobs

bunkerity/bunkerweb · src/scheduler/main.py:776

def generate_configs_for_jobs() -> bool:
    """Render for JobScheduler.run_pending(), which runs on this same main-loop thread.

    healthcheck_job skips its push while APPLYING_CHANGES is set, so the render has to hold the
    event, but handle_stop runs on this very thread: holding it here would leave nobody to clear
    it and every SIGTERM landing in the window would wait the full 30 s and then _exit(0) over
    the same half-written /etc/nginx. A worker thread clears it while the main frame is suspended
    in the signal handler, so handle_stop waits for the render it is meant to wait for.

    backup_failover copytrees /etc/nginx on that same pool; the main loop waits for it before
    every other render and so does this one, or the failover snapshot mixes two generations.
    """
    while BACKING_UP_FAILOVER.is_set():
        LOGGER.warning("Waiting for the failover backup to finish ...")
        sleep(1)

    return SCHEDULER_TASKS_EXECUTOR.submit(_render_holding_applying_changes).result()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…