perf: cap/batch untracked-file diff subprocess fan-out - #36
Open
uditdc wants to merge 1 commit into
Open
Conversation
Bounds the fan-out in /diff/working to 8 concurrent `git diff --no-index` calls instead of spawning one process per untracked file, so a repo with hundreds of untracked files (e.g. an accidental node_modules add) doesn't fork hundreds of processes at once.
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.
Closes #10
GET /diff/workingpreviously spawned onegit diff --no-indexsubprocess per untracked file viaPromise.all, so a repo with hundreds of untracked files (e.g. an accidentalnode_modulesadd) would fan out hundreds of concurrent processes.This adds a small
mapWithConcurrencyhelper insrc/server/routes/diff.tsand uses it to cap the untracked-file diffing to 8 concurrent subprocesses instead of adding a new dependency for it.Acceptance criteria
mapWithConcurrencywith a cap of 8 concurrentgit diff --no-indexcalls indiffRoutes's/diff/workinghandler.tests/concurrency.test.tsexercisesmapWithConcurrencywith a 250-item fixture and asserts the number of in-flight calls never exceeds the configured limit (also covers full/in-order processing and edge cases like an empty list).pnpm typecheck,pnpm test, andpnpm buildall pass.Generated by Claude Code