-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Fix using negative delay #53088
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
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
src/Symfony/Component/Messenger/Bridge/Doctrine/Tests/Transport/DoctrineIntegrationTest.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Oskar Stark <oskarstark@googlemail.com>
Actually, I do not really understand the use case for using a negative delay. Is that really something that needs to be supported? |
As far as I understand, the problem is that it does not work right now, and this can happen due to calculation, so it should "just" send the message right? |
@xabbuh If you have a long queue, you can cut in front of the queue with this negative delay because messages are sorted by So it's about priority within a single queue basically. |
Actually, it was already possible to set negative delays, but the behaviour was unexpected (in my opinion). Another solution could be to set the time to "now" in case of a negative delay. But then use cases like described by @valtzu wouldn't be supported. |
I'm not certain on this because:
As i see it, you removed a valid safeguard in the code to allow a "non-written" behaviour.. and i'm pretty sure this will not lead to good things :) And finally... there is a simpler / documented way to handle queue priority: queue priority. On a fonctional level, does this not fill your needs ? |
I agree that you can discuss about the expected behaviour, but I think that what you at least wouldn't expect, is that a negative delay is converted to a positive delay. How it's supposed to work apart from that, could maybe remain undefined. |
I totally agree! |
@J-roen Can you create a PR for Symfony 5.4, which is also affected? |
Yes, I can do that later this week. And what about 7.x? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you
@J-roen Can you create a PR for Symfony 5.4, which is also affected?
Yes, I can do that later this week. And what about 7.x?
It is no need to add this to 7.x. When this is merged in 6.4 it will be merge "up" to 7.0 and 7.1 by a maintainer.
This PR was squashed before being merged into the 5.4 branch. Discussion ---------- [Messenger] Fix using negative delay | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | Fix #50833 | License | MIT Fixes using negative delays when sending messages. Cherry-picked from #53088. Commits ------- af1517e [Messenger] Fix using negative delay
Fixes using negative delays when sending messages.