-
-
Couldn't load subscription status.
- Fork 4.6k
Fix TimedJob execution time to allow job execution exactly when scheduled #53418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@come-nc as you suggested, I added some code to remove the job if it runs but the user does not exist any longer and a test for this case. |
fa0a2ec to
2b2d3d9
Compare
|
/backport to stable30 |
|
/backport to stable31 |
2b2d3d9 to
e95fb81
Compare
apps/user_status/lib/BackgroundJob/ClearOldStatusesBackgroundJob.php
Outdated
Show resolved
Hide resolved
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
b7f574b to
5563503
Compare
These jobs that were setting their interval to 0 were not really running at every run of cron.php if the run was in the same second. To keep the same behaior, I am updating those intervals to 1 second. Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
5563503 to
289b7ab
Compare
Summary
This PR is a follow-up to address issues discovered while investigating issue #49584
While investigating the issue above, I noticed that when running
occ background-job:workerthe same job can be seen running several times, with each run in rapid succession after the other. The problem comes from an inconsistency in the comparison of timestamps between the logic that picks up jobs to execute and the logic insideTimedJob::start.The jobs appearing in rapid succession would appear as ran, but because of the logic they would not really run until the next second. For the same reason, jobs that apparently ran when executing
cron.phpin the same second they were scheduled, were actually not run but silently skipped until the next run.For the reasons above, this PR:
TimedJobto run timed jobs when they are picked up at the exact same second they are due.ClearOldStatusesBackgroundJobandUserStatusAutomationto run in intervals of 1s.Checklist