fix(core): skip stale recomputations and prevent lost file changes in daemon#34424
Merged
FrozenPandaz merged 2 commits intomasterfrom Feb 18, 2026
Merged
fix(core): skip stale recomputations and prevent lost file changes in daemon#34424FrozenPandaz merged 2 commits intomasterfrom
FrozenPandaz merged 2 commits intomasterfrom
Conversation
Contributor
|
View your CI Pipeline Execution ↗ for commit 7214315
☁️ Nx Cloud last updated this comment at |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
AgentEnder
approved these changes
Feb 12, 2026
| return cachedSerializedProjectGraphPromise; | ||
| } | ||
|
|
||
| await processCollectedUpdatedAndDeletedFiles( |
Collaborator
There was a problem hiding this comment.
Double, triple check that this will indeed take the stale updated/deleted files into account.
Member
Author
There was a problem hiding this comment.
So, the changes didn't introduce new issues, but while reviewing, I did find a couple of pre-existing race conditions. So, I sent another commit to fix them too.
When file changes arrive rapidly, multiple recomputations can start concurrently. Previously all would run to completion doing redundant work. Add a generation counter that allows in-progress recomputations to detect when a newer one has started and exit early by chaining to the newer promise. Prevents redundant work when rapid file changes trigger overlapping recomputations.
…ject graph recomputation
508e909 to
7214315
Compare
Hardanish-Singh
approved these changes
Feb 18, 2026
FrozenPandaz
approved these changes
Feb 18, 2026
FrozenPandaz
pushed a commit
that referenced
this pull request
Feb 20, 2026
… daemon (#34424) ## Current Behavior When file changes arrive rapidly, the daemon triggers multiple concurrent project graph recomputations that all run to completion — wasting CPU/memory on redundant work and returning stale results. Additionally, after processing file changes, the daemon clears all tracked files indiscriminately. Files that changed mid-recomputation are silently lost and never reflected in the project graph until another unrelated file change arrives. ## Expected Behavior Stale recomputations detect when a newer one has started and exit early, chaining to the newer promise so callers always get the freshest result. File change tracking now uses versioned maps. Each batch of file watcher events gets a unique version, and only files matching the snapshotted version are cleared after processing. Files that changed mid-recomputation are preserved and picked up by the next cycle. (cherry picked from commit 91b350e)
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.
Current Behavior
When file changes arrive rapidly, the daemon triggers multiple concurrent project graph recomputations that all run to completion — wasting CPU/memory on redundant work and returning stale results.
Additionally, after processing file changes, the daemon clears all tracked files indiscriminately. Files that changed mid-recomputation are silently lost and never reflected in the project graph until another unrelated file change arrives.
Expected Behavior
Stale recomputations detect when a newer one has started and exit early, chaining to the newer promise so callers always get the freshest result.
File change tracking now uses versioned maps. Each batch of file watcher events gets a unique version, and only files matching the snapshotted version are cleared after processing. Files that changed mid-recomputation are preserved and picked up by the next cycle.