aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/async_hooks.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/node/async_hooks.js')
-rw-r--r--src/js/node/async_hooks.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/js/node/async_hooks.js b/src/js/node/async_hooks.js
index c68a15dbe..7887bb64f 100644
--- a/src/js/node/async_hooks.js
+++ b/src/js/node/async_hooks.js
@@ -148,8 +148,16 @@ class AsyncResource {
constructor(type, triggerAsyncId) {
this.type = type;
this.triggerAsyncId = triggerAsyncId;
+
+ if (AsyncResource.allowedRunInAsyncScope.has(type)) {
+ this.runInAsyncScope = this.#runInAsyncScope;
+ }
}
+ // We probably will not fully support AsyncResource
+ // But some packages in the wild do depend on it
+ static allowedRunInAsyncScope = new Set(["prisma-client-request"]);
+
type;
triggerAsyncId;
@@ -163,7 +171,9 @@ class AsyncResource {
emitDestroy() {}
- runInAsyncScope(fn, ...args) {
+ runInAsyncScope;
+
+ #runInAsyncScope(fn, ...args) {
var result, err;
process.nextTick(fn => {
try {