Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Belanger <stephen.belanger@datadoghq.com>2022-11-09 23:23:22 +0300
committerStephen Belanger <stephen.belanger@datadoghq.com>2022-11-09 23:23:22 +0300
commit789d1e072eed046a209c4ac3956b3f45847bd05a (patch)
tree4896044baa5658aca322e96e9546a21fae3f4446
parentf8605a62b49003cc0bbe703361b848aa1ea4ddae (diff)
diagnostics_channel: Avoid wrapping with no subscribersdiagnostics-channel-tracing-channel
-rw-r--r--lib/diagnostics_channel.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/diagnostics_channel.js b/lib/diagnostics_channel.js
index 0ed3dffac26..9e95131639a 100644
--- a/lib/diagnostics_channel.js
+++ b/lib/diagnostics_channel.js
@@ -182,6 +182,7 @@ class TracingChannel {
}
traceSync(fn, ctx = {}, thisArg, ...args) {
+ if (!this.hasSubscribers) return ReflectApply(fn, thisArg, args);
const { start, end, error } = this.#channels;
start.publish(ctx);
try {
@@ -198,6 +199,7 @@ class TracingChannel {
}
tracePromise(fn, ctx = {}, thisArg, ...args) {
+ if (!this.hasSubscribers) return ReflectApply(fn, thisArg, args);
const { asyncEnd, start, end, error } = this.#channels;
start.publish(ctx);
@@ -227,6 +229,7 @@ class TracingChannel {
}
traceCallback(fn, position = 0, ctx = {}, thisArg, ...args) {
+ if (!this.hasSubscribers) return ReflectApply(fn, thisArg, args);
const { start, end, asyncEnd, error } = this.#channels;
start.publish(ctx);