diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/async_hooks.exports.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bun.js/async_hooks.exports.js b/src/bun.js/async_hooks.exports.js index c5bc6f620..1b5664bc2 100644 --- a/src/bun.js/async_hooks.exports.js +++ b/src/bun.js/async_hooks.exports.js @@ -32,9 +32,10 @@ class AsyncLocalStorage { run(store, callback, ...args) { if (typeof callback !== "function") throw new TypeError("ERR_INVALID_CALLBACK"); - var prev = this.#store; var result, err; + process.nextTick(store => { + const prev = this.#store; this.enterWith(store); try { result = callback(...args); @@ -42,7 +43,6 @@ class AsyncLocalStorage { err = e; } finally { this.#store = prev; - prev = undefined; } }, store); drainMicrotasks(); |