Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/diagnostics_channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ class Channel {
}

subscribe(subscription) {
validateFunction(subscription, 'subscription');
markActive(this);
this.subscribe(subscription);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ assert.ok(!channel.unsubscribe(subscriber));
assert.throws(() => {
channel.subscribe(null);
}, { code: 'ERR_INVALID_ARG_TYPE' });
assert.ok(!channel.hasSubscribers);
assert.ok(!dc.hasSubscribers('test'));
2 changes: 2 additions & 0 deletions test/parallel/test-diagnostics-channel-pub-sub.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ assert.ok(!dc.unsubscribe(name, subscriber));
assert.throws(() => {
dc.subscribe(name, null);
}, { code: 'ERR_INVALID_ARG_TYPE' });
assert.ok(!channel.hasSubscribers);
assert.ok(!dc.hasSubscribers(name));

// Reaching zero subscribers should not delete from the channels map as there
// will be no more weakref to incRef if another subscribe happens while the
Expand Down
Loading