Skip to content

fix(nxls): debounce PassiveDaemonWatcher callback to prevent reconfigure flood#3107

Closed
MaxKless wants to merge 1 commit intomasterfrom
meadow-niece
Closed

fix(nxls): debounce PassiveDaemonWatcher callback to prevent reconfigure flood#3107
MaxKless wants to merge 1 commit intomasterfrom
meadow-niece

Conversation

@MaxKless
Copy link
Copy Markdown
Contributor

@MaxKless MaxKless commented Apr 7, 2026

Summary

  • Adds a 1-second debounce to the PassiveDaemonWatcher listener callback, matching the existing debounce on the old DaemonWatcher path
  • Prevents the Nx daemon from flooding the language server with thousands of concurrent reconfigure cycles when it delivers a burst of project graph recomputation notifications

Fixes #3101

Context

The Nx daemon can deliver bursts of project graph recomputation notifications (16k+ observed in the logs attached to #3101). The old DaemonWatcher path (used for Nx < 22.5.0) already wraps its callback with debounce(callback, 1000), but the new PassiveDaemonWatcher path (Nx >= 22.5.0) passes the callback through directly. Each notification triggers a full reconfigure() cycle — and while nxWorkspace() deduplicates the project graph computation, the 16k concurrent reconfigure calls all proceed to re-register watchers and configure schemas simultaneously, freezing the language server.

Test plan

  • Verify existing e2e tests pass
  • Manually test with a large Nx workspace (Nx >= 22.5.0) — file changes should still trigger workspace refresh, but rapid bursts should coalesce into a single refresh

🤖 Generated with Claude Code

…ure flood

The Nx daemon can deliver bursts of project graph recomputation
notifications (16k+ observed in #3101). Without debouncing, each
notification triggers a full reconfigure cycle, effectively freezing the
language server. The old DaemonWatcher path already debounced at 1s —
apply the same to the PassiveDaemonWatcher path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nx-cloud-snapshot
Copy link
Copy Markdown
Contributor

nx-cloud-snapshot bot commented Apr 7, 2026

View your CI Pipeline Execution ↗ for commit 168e3ae

Command Status Duration Result
nx affected --targets=lint,test,build,e2e-ci,ty... ✅ Succeeded 9m 42s View ↗
nx-cloud record -- yarn nx sync:check ✅ Succeeded 8s View ↗
nx-cloud record -- yarn nx run-many -t ktfmtFormat ✅ Succeeded 5m 29s View ↗
nx run-many -t ktfmtFormat ✅ Succeeded 5m 25s View ↗
nx-cloud record -- yarn nx format:check --verbose ✅ Succeeded 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-04-07 10:41:45 UTC

@MaxKless
Copy link
Copy Markdown
Contributor Author

MaxKless commented Apr 7, 2026

duplicate of #3104 (review)

@MaxKless MaxKless closed this Apr 7, 2026
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.

Nx Console often gets stuck on “Refreshing workspace”

1 participant