Skip to content

Commit 004eafb

Browse files
simon-idrichardlau
authored andcommitted
lib: add unsubscribe method to non-active DC channels
PR-URL: #40433 Reviewed-By: Vladimir de Turckheim <vlad2t@hotmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Bryan English <bryan@bryanenglish.com> Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
1 parent 625be75 commit 004eafb

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

doc/api/diagnostics_channel.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ added:
162162
changes:
163163
- version: REPLACEME
164164
pr-url: https://github.com/nodejs/node/pull/40433
165-
description: Added return value.
165+
description: Added return value. Added to channels without subscribers.
166166
-->
167167

168168
* `onMessage` {Function} The previous subscribed handler to remove

lib/diagnostics_channel.js

+4
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ class Channel {
8181
this.subscribe(subscription);
8282
}
8383

84+
unsubscribe() {
85+
return false;
86+
}
87+
8488
get hasSubscribers() {
8589
return false;
8690
}

0 commit comments

Comments
 (0)