-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Ceil waiting time when multiplier is a float on retry #46797
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
[Messenger] Ceil waiting time when multiplier is a float on retry #46797
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 |
Thank you. Can you please add a test that reproduces your bug? |
Absolutely, I have updated the Let me know if you need anything else |
Thank you. However, the tests you've added pass even without your change. |
One more thing, is Symfony 4.4 also affected by this bug? If so, we need to rebase your PR to the 4.4 branch. |
That's not quite right, there is an issue with how the tests are currently set up. The testGetWaitTime function in the MultiplierRetryStrategy is wrong, the test function has this profile
When the constructor of the MultiplierRetryStrategy has this profile
If I just add the scenario where the multiplier is a float and I don't change anything else, the test is failing.
Now if apply the change in the So I need to change the profile of the test to reflect the actual parameters that are allowed by the I think the issue needed 2 fix
Let me know if you still think that I missed something, I'll be happy to take another look. Thanks! :) |
I'll wait for you to confirm the comment is ok, then I'll rebase on Symfony 4.4 and change the base for the PR |
Mmh that's interesting, I did some more digging and I found this PR that was accepted in April this year -- https://github.com/symfony/symfony/pull/45925/files# Not sure how to reproduce this bug then |
In this case, a deprecation was here before fix
In our case no deprecation is triggered. And I confirm bug in 4.4 |
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.
(I improved the tests to trigger the deprecation without the patch)
Thank you @WissameMekhilef. |
In the Messenger - MultiplierRetryStrategy the return type for the function
getWaitingTime
is int, however with the computation of that function we were returning a float, this is because float * int returns a float and the attribute $multiplier is a float.With this fix, we are rounding up the delay and casting into an int.