schedule icon indicating copy to clipboard operation
schedule copied to clipboard

instant execution of job with every().days.at on first run

Open alkanex-xyz opened this issue 2 years ago • 6 comments

When I schedule a job with schedule.every().days.at("00:00:20", timezone("Europe/Amsterdam")).do() the job will run immediately even if the first call of run_pending is at 15:00.

How can i prevent the instant execution? The first execution shall be at the next day

Python3.11 Schedule 1.2.1

alkanex-xyz avatar Oct 19 '23 13:10 alkanex-xyz

maybe some additional infos:

On my windows 11 PC this doesn't seems to happen. On the script running in kubernetes containers on mediawikis toolforge servers it seems to occure only on jobs which are scheduled in hour 0 and 1.

The servers time is set to UTC.

alkanex-xyz avatar Oct 19 '23 21:10 alkanex-xyz

Further tests:

When I set my timezone to UTC the same thing occurs. If the job is scheduled between 00:00 and 01:59 (MEST) the task will run immediately and additional: the task is immediately rescheduled after each run. I would guess till the 2 hours offset between UTC and MEST have passed

alkanex-xyz avatar Oct 19 '23 22:10 alkanex-xyz

Thank you the detailed explanation and investigation. This is indeed a bug. I've started working on a fix in #604

SijmenHuizenga avatar Oct 23 '23 07:10 SijmenHuizenga

Hi @alkanex-xyz, the fix in #604 seems to work good with the test cases I can come up with. Would you be willing to also take a look at it? Either by reviewing, running it as part of your program or by writing a unit-test like the these ones that represents your situation? Any testing/reviewing help would be super helpful to move this forward.

SijmenHuizenga avatar Oct 25 '23 09:10 SijmenHuizenga

Hey, I've tested my case and the schedule run as intended. Thanks a lot .

alkanex-xyz avatar Oct 31 '23 10:10 alkanex-xyz

#609 Sorry I did create a duplicate, did not find this issue before as I thought it was Docker related. The issue is still persisting for me.

wasnertobias avatar Dec 08 '23 14:12 wasnertobias