Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixed the issue where the Queue retry time test, when using the Redis Driver, would occasionally fail.
For example, #48662 (comment) also seems to have encountered this problem.
An earlier attempt was made to address this problem by retrying the test itself, as seen in commit e0d8e3d .
However, it was not a fundamental solution.
In the test, we specified a delay of 10 minutes and asserted that the actual delay was 600 seconds . However, due to the time elapsed during the test execution, the test may rarely reach 599 seconds and fail. I solved this problem by fixing the time using
Carbon::setTestNow()
at the beginning of the test.Before the fix, the test would fail after about 30 to 100 attempts. After the fix, I tried it 10,000 times and it didn't fail.
Note
It actually asserts for more than 600 seconds. This is because redis-server calculates the retry time, so it cannot be controlled with setTestNow().
framework/src/Illuminate/Redis/Limiters/DurationLimiter.php
Lines 103 to 114 in cddb4f3