Skip to content

feat(ProjectManager): limit concurrency of project activation#1627

Open
bartvandenende-wm wants to merge 3 commits intorokucommunity:masterfrom
bartvandenende-wm:feature/throttle-project-activation
Open

feat(ProjectManager): limit concurrency of project activation#1627
bartvandenende-wm wants to merge 3 commits intorokucommunity:masterfrom
bartvandenende-wm:feature/throttle-project-activation

Conversation

@bartvandenende-wm
Copy link
Contributor

@bartvandenende-wm bartvandenende-wm commented Feb 15, 2026

Context

In large multi-project workspaces, all discovered projects activate simultaneously via Promise.all, creating a CPU spike that can saturate all cores during startup. This is part 2 of 3 targeted improvements to language server performance at scale (Part of #1625).

Summary

Limits the number of projects that activate concurrently during syncProjects to prevent CPU spikes when many projects are discovered.

  • Replaces Promise.all with a worker-pool pattern (default concurrency limit: 3)
  • All projects still activate, but CPU load is spread over time
  • Configurable via ProjectManager.projectActivationConcurrencyLimit

Test plan

  • New tests verify concurrent activations do not exceed the configured limit
  • New tests verify all projects eventually activate
  • Existing syncProjects tests pass unchanged

When many projects are discovered (e.g. in a monorepo with dozens of
bsconfig.json files), activating all of them in parallel via Promise.all
causes severe CPU spikes as each activation involves parsing all project
files and running plugins.

Replace unbounded Promise.all with a concurrency-limited executor that
activates at most N projects simultaneously (default 3). This spreads
the activation work over time, reducing peak CPU and memory usage.

The concurrency limit is configurable via the static property
ProjectManager.projectActivationConcurrencyLimit.

Co-authored-by: Cursor <cursoragent@cursor.com>
@bartvandenende-wm bartvandenende-wm force-pushed the feature/throttle-project-activation branch from e54bf00 to f2b2e37 Compare February 15, 2026 15:25
bartvandenende-wm and others added 2 commits February 16, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments