aboutsummaryrefslogtreecommitdiff
path: root/src/js/node/async_hooks.js
diff options
context:
space:
mode:
authorGravatar dave caruso <me@paperdave.net> 2023-06-03 00:36:05 -0400
committerGravatar GitHub <noreply@github.com> 2023-06-02 21:36:05 -0700
commitcfd73cec816cb73e0017cf306e133a7b0e5ae4eb (patch)
treeb628d48e6962f9e71e3b9b75884f684d8297e180 /src/js/node/async_hooks.js
parent3e437a6ae0d4a68f8f29c60276918d662ad7bbc7 (diff)
downloadbun-cfd73cec816cb73e0017cf306e133a7b0e5ae4eb.tar.gz
bun-cfd73cec816cb73e0017cf306e133a7b0e5ae4eb.tar.zst
bun-cfd73cec816cb73e0017cf306e133a7b0e5ae4eb.zip
fixes with hardcoded modules (#3182)
* fixes with hardcoded modules * add make hardcoded to make dev * adjust this message * remove debugging logs * this * restore2
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 {