Skip to content

diagnostics_channel: return a disposable from subscribe - #65383

Open
araujogui wants to merge 1 commit into
nodejs:mainfrom
araujogui:diagnostics-channel-subscribe-disposable
Open

diagnostics_channel: return a disposable from subscribe#65383
araujogui wants to merge 1 commit into
nodejs:mainfrom
araujogui:diagnostics-channel-subscribe-disposable

Conversation

@araujogui

Copy link
Copy Markdown
Member

Make subscribe return a Disposable so a subscription can be scoped with
using instead of pairing each call with a matching unsubscribe.

const channel = diagnostics_channel.channel('my-channel');

{
  using subscription = channel.subscribe((message, name) => {});
  channel.hasSubscribers; // true
}
channel.hasSubscribers; // false

Applies to diagnostics_channel.subscribe(), channel.subscribe(),
tracingChannel.subscribe(), and boundedChannel.subscribe(). The disposable
removes only the handlers that call registered, and disposing is idempotent.
Existing callers are unaffected — the return value was previously undefined.

Copilot AI lite review requested due to automatic review settings August 18, 2026 14:51

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@nodejs-github-bot nodejs-github-bot added diagnostics_channel Issues and PRs related to diagnostics channel needs-ci PRs that need a full CI run. labels Aug 18, 2026
Signed-off-by: Guilherme Araújo <arauujogui@gmail.com>
@araujogui
araujogui force-pushed the diagnostics-channel-subscribe-disposable branch from cd02941 to 27df399 Compare August 18, 2026 14:52
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.13%. Comparing base (cf30b2e) to head (27df399).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65383      +/-   ##
==========================================
+ Coverage   90.11%   90.13%   +0.01%     
==========================================
  Files         752      752              
  Lines      251861   251919      +58     
  Branches    47365    47373       +8     
==========================================
+ Hits       226955   227055     +100     
+ Misses      16238    16186      -52     
- Partials     8668     8678      +10     
Files with missing lines Coverage Δ
lib/diagnostics_channel.js 97.66% <100.00%> (+0.35%) ⬆️

... and 36 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

diagnostics_channel Issues and PRs related to diagnostics channel needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants