-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Scheduler doesn't store state #50669
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
Comments
what is the configuration of your cache ? Do you have a persistent cache like Redis ? Or is it using an ArrayCache that only caches in memory (and so will start the new process with an empty cache) ? |
As I mentioned in the issue, it's redis
|
I'm having the same issue. Are there any solutions/workarounds for this? |
Looked at the code; if you do not pass the Not sure if this is intended or not, but it is a (temporary) workaround... |
…eful run dates (StanJansen) This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [Scheduler] Fix `PeriodicalTrigger` from argument for stateful run dates | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #50669 | License | MIT | Doc PR | - Summary: Unless you provide the `from` argument (with a date in the past), caching will not work for the `PeriodicalTrigger`. If the `from` argument is not passed to the `RecurringMessage::every` method, it will, fallback to `new \DateTimeImmutable()`. If you use a stateful schedule and you restart the consumer (either manually or using a time limit), the cached last-executed date will always be overridden by the moment you restart the scheduler due to `if ($this->from > $run) {`. Commits ------- cb9be9f [Scheduler] Fix `PeriodicalTrigger` from argument for stateful run dates
Symfony version(s) affected
6.3.0
Description
I don't know if it's a bug or feature.
However if I'll put --time-limit in consumer command or I restart consumer during deployment it re-handles messages that shouldn't be re-handled (defined time has not yet passed)
How to reproduce
NOTE: in my local env lock and cache utilize redis
bin/console messenger:consume scheduler_test --time-limit=10 -v
Output 1st run
Output 2nd run
Only 12 seconds of difference, and message is registered as "every 30 seconds"
Possible Solution
No response
Additional Context
The text was updated successfully, but these errors were encountered: