Skip to content

perf(@angular/cli): implement semaphore backpressure throttling in PackageManager#33375

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:refactor-package-manager-concurrency
Jun 16, 2026
Merged

perf(@angular/cli): implement semaphore backpressure throttling in PackageManager#33375
alan-agius4 merged 1 commit into
angular:mainfrom
clydin:refactor-package-manager-concurrency

Conversation

@clydin

@clydin clydin commented Jun 15, 2026

Copy link
Copy Markdown
Member

Execute package manager subprocess invocations using a semaphore-based backpressure throttle.

When callers perform concurrent registry lookups (such as running Promise.all over candidate update packages), this prevents unbounded child subprocess spawning. Clamping active concurrent CLI commands to a fixed limit protects the operating system against process table exhaustion, V8 heap saturation, and upstream registry rate-limiting while maintaining fast execution.

@clydin clydin added the target: patch This PR is targeted for the next patch release label Jun 15, 2026
@angular-robot angular-robot Bot added area: performance Issues related to performance area: @angular/cli labels Jun 15, 2026
@clydin clydin marked this pull request as ready for review June 15, 2026 14:48

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces concurrency throttling to the PackageManager class, limiting concurrent executions to a maximum of 5. The review feedback recommends simplifying the queue mechanism by removing the unused reject callback from the pending tasks array and the throttling logic, which reduces unnecessary complexity.

Comment thread packages/angular/cli/src/package-managers/package-manager.ts Outdated
Comment thread packages/angular/cli/src/package-managers/package-manager.ts
…ckageManager

Execute package manager subprocess invocations using a semaphore-based backpressure throttle.

When callers perform concurrent registry lookups (such as running Promise.all over candidate
update packages), this prevents unbounded child subprocess spawning. Clamping active concurrent
CLI commands to a fixed limit protects the operating system against process table exhaustion, V8 heap
saturation, and upstream registry rate-limiting while maintaining fast execution.
@clydin clydin force-pushed the refactor-package-manager-concurrency branch from a7be714 to 4a5b437 Compare June 15, 2026 15:02
@clydin clydin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Jun 15, 2026
@clydin clydin requested a review from alan-agius4 June 15, 2026 15:08
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jun 16, 2026
@alan-agius4 alan-agius4 merged commit 3ce6e5f into angular:main Jun 16, 2026
39 of 40 checks passed
@alan-agius4

Copy link
Copy Markdown
Collaborator

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli area: performance Issues related to performance target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants