Skip to content

refactor(services): eliminate PubSub waste from file watchers - W-22143377#7224

Open
peternhale wants to merge 1 commit intodevelopfrom
phale/pubsub-waste-measurement
Open

refactor(services): eliminate PubSub waste from file watchers - W-22143377#7224
peternhale wants to merge 1 commit intodevelopfrom
phale/pubsub-waste-measurement

Conversation

@peternhale
Copy link
Copy Markdown
Contributor

What does this PR do?

Replace centralized PubSub file/settings watchers with scoped, per-consumer watchers:

  • sourceTrackingStatusBar: scope watchers to package directories via RelativePattern, filter with .forceignore, add callback-level debounce and in-flight cancellation ({ switch: true }). Eliminates ~45K wasted events and ~15-17 redundant getStatus calls during npm install.
  • aliasFileWatcher / configFileWatcher: use direct createFileSystemWatcher scoped to .sfdx/.sf paths instead of subscribing to global PubSub.
  • lwcFileWatcher / testResultsFileWatcher: replace PubSub subscription with scoped glob watchers (**/lwc/**/*.{js,ts,html,js-meta.xml}, **/.sfdx/tools/testresults/apex/*.json).
  • configWatcher / logAutoCollect: subscribe directly to onDidChangeConfiguration with pre-filtered callbacks instead of global SettingsChangePubSub.
  • Delete fileChangePubSub, fileWatcherService, settingsChangePubSub, settingsWatcherService and their exports.

What issues does this PR fix or reference?

@W-22143377@

Functionality Before

Global **/* file watcher fires ~45K events during npm install, each pushed through Effect PubSub, producing ~15-17 redundant getStatus calls.

Functionality After

Zero getStatus calls from file watcher during npm install. Only the 60s poll stream triggers status checks, which is the intended behavior.

…43377

Replace centralized PubSub file/settings watchers with scoped,
per-consumer watchers. Eliminates ~45K wasted events and ~15-17
redundant getStatus calls during npm install.
@peternhale peternhale requested a review from a team as a code owner April 20, 2026 18:02
@peternhale peternhale requested review from diyer and removed request for diyer April 20, 2026 18:02
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.

1 participant