perf(sync-server): fetch R2 payloads concurrently in pullItems#557
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
React Doctor found 3 files changed in this pull request, but none matched the files covered by its enabled checks. Scope: 3 files changed on Generated by React Doctor. Questions? Contact founders@million.dev. |
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
for awaitloop inpullItemswith bounded-concurrency windows (R2_CONCURRENCY = 25): map over the alreadyserver_cursor-sorted rows in fixed-size windows,await Promise.alleach window, concat in order. Cuts first-sync / large-pull latency from O(N) × per-object round-trips to overlapping reads, capped so a Worker never fires hundreds of simultaneous subrequests.server_cursor,nulls are filtered, andpullItems' signature/return type,toPullItemResponse, and the D1 batching loop are untouched.Test plan
pnpm typecheck:sync-server→ exit 0pnpm test:sync-server→ 634 pass (45 files), no flakepullItemstests:1 < peak ≤ R2_CONCURRENCY(this assertion is red on the old serial loop, so it pins the new behavior)Notes
MEMRY_DOCS_IMPACT_SKIP=1. This is an internal performance refactor with identical inputs/outputs/ordering — no API, contract, behavior, or documented-surface change, so there is nothing to update underapps/docs/src.Closes #548