Repository navigation
fix(utils): cancel pending batch timer on split flush - #5504
Merged
Merged
Conversation
A split flush left the previous batch's wait timer armed, so it later flushed the next batch under the same id before its wait elapsed. Co-authored-by: zjuncal <[email protected]> Amp-Thread-ID: https://ampcode.com/threads/T-01a1ced8-5803-75d7-b106-9fcea9f5b316 Co-authored-by: jxom <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: eec11db The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Merged
This branch had an error being deployed
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.
Supersedes #5500 by @zjuncal (credited as co-author).
When
shouldSplitBatchflushed a batch early, itswaittimer stayed armed and later flushed the next batch under the sameidbefore that batch'swaitelapsed. This affectshttpand multicall batching with a non-zerowait. No requests were dropped or duplicated, but batches were smaller and more requests went out.Example with
wait: 100, splitting at more than 2 items. Items 1 and 2 arrive at t=0, item 3 at t=50 (splits), item 4 at t=70, item 5 at t=120:[1,2]flushed at 51,[3,4]at 100 (should be 150, or at the next split),[5]at 152 (32ms after it arrived).[1,2]at 51,[3,4]at 120 (split by item 5),[5]at 221.The timer handle is now stored per scheduler
idand cleared inflush(), which every flush path goes through. It is keyed byidrather than kept per instance because callers create a new scheduler on each request and share batches byid.The regression test fails on
mainand passes with the fix. It relies on the order in which timers are due, not on tight timing.