fix: resolve request hang with pageSize and fetchLinks
#437
+45
−7
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.
Resolves: #435
Description
Fixes an issue where
getByType()and similar methods hang indefinitely when usingpageSize: 100combined withfetchLinkson repositories with many documents.The issue was introduced in v7.19.2 when request deduplication was refactored. Multiple callers sharing a deduplicated request would each try to read from the same response stream, causing hangs with large responses.
The changes in this PR result in ~2x faster responses compared to
v7.18and ~5x faster thanv7.19in the specific scenario detailed in #435.Checklist
Preview
N/A
How to QA 1
npm test🦥
Note
Medium Risk
Touches the core request/deduplication layer and subtly changes
ResponseLike.clone()semantics, which could affect downstream code that relies on independent response streams.Overview
Fixes deduplicated GET requests so multiple callers don’t compete for the same response body stream.
This wraps deduplicated
fetch()responses in a memoizingResponseLike(memoizeResponse) that cachestext(),json(), andblob()reads usingclone(), and stops returningresponse.clone()at the end ofrequest()(returning the memoized wrapper instead).Written by Cursor Bugbot for commit e5166dc. This will update automatically on new commits. Configure here.
Footnotes
Please use these labels when submitting a review:
⚠️ #issue: Strongly suggest a change.
❓ #ask: Ask a question.
💡 #idea: Suggest an idea.
🎉 #nice: Share a compliment. ↩