fix: Preserve forefront flag on RequestQueue retry path#1861
Merged
Conversation
When `add_batch_of_requests` returned unprocessed requests, the recursive `_process_batch` retry dropped the `forefront` kwarg and fell back to the default `False`, silently re-inserting requests at the back of the queue and breaking the priority-ordering guarantee.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1861 +/- ##
=======================================
Coverage 92.41% 92.42%
=======================================
Files 158 158
Lines 11009 11009
=======================================
+ Hits 10174 10175 +1
+ Misses 835 834 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
RequestQueue._process_batchaccepts aforefrontflag and forwards it on the first attempt toadd_batch_of_requests. When the storage client returned unprocessed requests, the recursive retry call omittedforefront, so it fell back to the parameter defaultFalseregardless of what the original caller asked for.A user calling
add_requests(..., forefront=True)would silently see requests appended to the back of the queue whenever they happened to be in anunprocessed_requestsresponse, breaking the priority-ordering guarantee.Fix
Forward
forefront=forefrontin the recursive_process_batchcall.Test
Added a regression test (parametrized over
TrueandFalse) that mocksadd_batch_of_requeststo return all requests as unprocessed on the first call and asserts the retry uses the sameforefrontvalue as the original call.