When scheduling a cron job daily, the starting hour is shifting a little bit every day.
It means that eventually, we'll get a day skipped from 23:59 to 00:01, 2 days later.
It can be a problem e.g. for membership schedule reminders where we check for all membership that correspond to the today's date. Some schedule reminders won't be sent.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
The Scheduled Job config form has a next-sched date/time. We should be able to set it so that it runs at a specific time (for daily/weekly/monthly jobs).
It might have challenges, because jobs don't run at an exact time, so let's say it should run at 1:00 AM daily, and it ends up running at 2018-10-01 01:15, then the next-scheduled time should be 2018-10-02 01:00.
We want to avoid existing issues with Scheduled Job, where if it drifts around 23:59, cron runs at 00:15, then it will have ended up skipping a day. -- we might want to warn against setting a time such as after 23:00.
Other background: CiviCRM has a 'cleanup' Scheduled Job that runs daily. It ends up drifting to day-time, where it then randomly flushes the cache, which affects the quickform session cache, meaning that people in the middle of an event registration, or a contribution, will encounter a fatal error ("you must accept cookies")
The extension is basically the 4.6 version of what's now in 4.7+.
Seems to me, that since the smallest job interval is hourly, let last_run be calculated as is but then set the minutes to 00 before saving. Wouldn't that stop the drift?
Another option would be to determine all the jobs that are going to run at the beginning of scheduled jobs and set last_run then, prior to running any of the jobs. That way an earlier long running job doesn't push out a later running job. Right now, last_run is set right before running each job.
A job might crash/fatal while it's running, causing the other jobs not to run.
Multi-process: if a mailing is running for 1h, the system can still run other jobs in parallel (ex: so that mailings don't delay the processing of recurring contributions or scheduled reminders). On smaller systems, avoiding that might be a good feature, however, but right now, nothing stops multiple job processes to run at the same time.
On calculating minutes to stop the drift, I think it makes sense to do similar to what you're proposing:
daily jobs: concat("current day", "time set in the config settings")
Thank you for raising an issue to help improve CiviCRM. We're sorry about this, but this particular issue has gone unnoticed for quite some time.
We would like to ask you to help us out and determine whether this issue should be kept open:
If this issue is reporting a bug, can you attempt to reproduce on the latest version of CiviCRM?
If this issue is proposing a new feature, can you verify whether the feature proposal is still relevant? Did it get the concept-approved label? Have other people also shown interest? Could it be implemented as an extension?
If yes,
Is it something that you could help implement, either by sending a patch or hiring someone who can?
Please feel free to comment or re-open the issue. We understand that automatic responses are annoying, but as the project evolves, we need a bit of help to triage and prioritise the most relevant issues.
Thank you for your help
P.S. This is an automated message. See infra/gitlab issue 20.