[Python] APScheduler Jitter Causes Multiple Runs

Discussão em 'Python' iniciado por Stack, Abril 19, 2025.

  1. Stack

    Stack Membro Participativo

    I a have a job that I want to run once per day at 9am +- 15min. Here is my code:

    def Function():
    requests.get("https://EXAMPLE.com")
    logger.info("Ran function")

    sched.add_job(Function, 'cron', hour=9, jitter=900)
    sched.start()
    try:
    while True:
    time.sleep(2)
    except (KeyboardInterrupt, SystemExit):
    sched.shutdown()


    Yesterday the function ran at 8:57AM and 9:08AM. Today the function ran at 8:48AM. 8:55AM, and 9:08AM. Why does it keep running more instances with each passing day?

    Continue reading...

Compartilhe esta Página