schedule icon indicating copy to clipboard operation
schedule copied to clipboard

run_all sleeps after the final job despite documenting delays between jobs

Open Gambit-Checkmate opened this issue 1 month ago • 0 comments

Reproduction

On the current master, Scheduler.run_all(delay_seconds=2) calls time.sleep(2) after the last job, including when there is only one job. The docstring describes a delay between jobs.

Patching schedule.time.sleep and recording events for a single registered job produces [job, sleep]; I would expect [job]. With three jobs the current sequence ends with an extra sleep after the third job.

Proposed fix

Sleep before each job except the first, retaining the existing snapshot of registered jobs. I have a regression test covering zero, one and three jobs and can submit the fix.

Found through code inspection and reproduced with a regression test. This contribution was prepared with OpenAI Codex assistance.

Gambit-Checkmate avatar Oct 17 '26 00:10 Gambit-Checkmate