I started my server at 4:30PM and I have a cron job that should run every weekday at 6:00PM 0 0 18 * * Mon,Tue,Wed,Thu,Fri. And I take 1 off the upcoming schedule schedule.upcoming(Utc).take(1).next().unwrap(). Then I log it and I get Job scheduled at: 2024-07-26T18:00:00Z(tomorrow). However it's 4:30PM and 6:00PM is an hour and thirty minutes away, why isn't it's next start time in an hour and thirty minutes 2024-07-25T18:00:00Z(today)?
Resuming a job, i'm not sure how to do it with cron. For example lets say I redeploy my application during the day at a time that happens to fall during the running of a job like */5 * 10-12 * * Mon,Tue,Wed,Thu,Fri that runs every 5 seconds from 10AM to 12PM. Lets say I redploy my applicatoin at 11AM the next upcoming schedule for the cron job */5 * 10-12 * * Mon,Tue,Wed,Thu,Fri is tomorrow, but I would like it to resume doing what it was doing, is there a way to do this with cron?
Could you turn your first question into a unit test that fails? That would help both in debugging and in making sure that the problem is fixed. You don't mention what timezone your machine is in, which would influence the Utc view of the next fire time.
I believe I'm missing something. If the job runs every five seconds between 10 and noon and your application checks the schedule at 11am, it should be told that the next fire time is five seconds away. If instead it tells you that the next fire time is a day away, that sounds like a bug. Could you please make a failing unit test for this one too?
For both of these, use the Schedule::after method to specify the time after which you'd like the next fire time.
I have 2 questions:
0 0 18 * * Mon,Tue,Wed,Thu,Fri
. And I take 1 off the upcoming scheduleschedule.upcoming(Utc).take(1).next().unwrap()
. Then I log it and I getJob scheduled at: 2024-07-26T18:00:00Z
(tomorrow). However it's 4:30PM and 6:00PM is an hour and thirty minutes away, why isn't it's next start time in an hour and thirty minutes2024-07-25T18:00:00Z
(today)?cron
. For example lets say I redeploy my application during the day at a time that happens to fall during the running of a job like*/5 * 10-12 * * Mon,Tue,Wed,Thu,Fri
that runs every 5 seconds from 10AM to 12PM. Lets say I redploy my applicatoin at 11AM the next upcoming schedule for the cron job*/5 * 10-12 * * Mon,Tue,Wed,Thu,Fri
is tomorrow, but I would like it to resume doing what it was doing, is there a way to do this withcron
?