fix: populate LRU for batched invocations in minimal mode response cache#93699
Open
craigandrews wants to merge 1 commit intovercel:canaryfrom
Open
Conversation
Contributor
Failing test suitesCommit: 2091e64 | About building and testing Next.js
Expand output● prefetch={true} with instant route › does not include dynamic content in the prefetch when the target route has instant |
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.
Summary
When multiple minimal mode revalidation invocations (different
x-invocation-id) arrive concurrently for the same path, the batcher correctly deduplicates them into a single render. However, the LRU is only populated for the invocation that actually rendered. Batched invocations never execute the work function where the LRU write happens. This causes follow-up requests to miss the LRU and trigger a new render, creating a cascade of redundant renders under load.The fix writes the render result to the LRU for each batched invocation's ID after the batcher promise resolves, so follow-up requests find their entry without re-rendering.
Test Plan
invocationIDvalues verify only one render executes and follow-up requests hit the LRU