-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Scheduler] Recuring messages not dispatched if cache TTL is less than the message frequency. #52911
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
You are right that Scheduler in stateful mode only works correctly with non-expiring cache. Option 3 of your suggested solutions would sound the best to me, though I'm not super familiar with the cache component and the behavior of different implementations/providers. Of course cache by definition is usually considered something you can clear any time without affecting business logic – which brings up the question: is using cache for the Scheduler state a good idea in the first place. |
This is a good point. I guess the simplest solution would be to configure it to use a scheduler-specific cache. |
Good find, I would agree that this could be improved. I am looking into the different proposed solutions. Some thoughts:
|
Hey, thanks for your report! |
yes this bug still relevant. |
I am completely new to the subject of schedulers and may have a few problems understanding them, but according to Messenger: Deploying to Production it makes no sense to define long time intervals with the current behavior.
Maybe there is a solution using some cache, which fixes #58124 at the same time. Or alternatively a --date parameter like in debug:scheduler command for messenger:consume, which then processes outdated jobs first. So it is possible to implement a cache by yourself. |
Hey, thanks for your report! |
still a bug. |
Same here. Any update planned soon? |
@upgrader-dev Someone would need to work on it and submit a pull request. Would you be interested in giving it a try? |
Thank you but I'm just a beginner with Symfony. I'll give it a try anyway. |
Symfony version(s) affected
6.4.1/7.0.1
Description
There is a bug in the Symfony Scheduler component where the cache TTL is erroneously set to a value less than a Scheduler's Message Frequency.
This causes the Scheduler to not dispatch any recurring messages at all.
Using a Cache with a TLL less than a Scheduler's Message Frequency is obviously wrong.
There should be no TTL at all, but it seems Scheduler should be able to handle this the same as a cache miss at continue producing messages as if there was no cache used.
How to reproduce
Follow reproduction steps at https://github.com/bendavies/symfony-bug-52911
Possible Solution
Not really sure?
$item->expiresAfter(0)
atsymfony/src/Symfony/Component/Scheduler/Generator/Checkpoint.php
Line 41 in dc330b0
Additional Context
No response
The text was updated successfully, but these errors were encountered: