summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/_next_tick.ts
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-08-02 11:16:59 -0700
committerGitHub <noreply@github.com>2024-08-02 18:16:59 +0000
commit71ca61e189cca9215982ce4598b7a4da8430c584 (patch)
treea0dd2aa94cf61103b1dbcfa28a6c67feebf6eedd /ext/node/polyfills/_next_tick.ts
parent3a1a1cc030fb7fc90d51ee27162466d6ac924926 (diff)
Revert "feat: async context" (#24856)
Reverts denoland/deno#24402 deno_web can't depend on code in runtime
Diffstat (limited to 'ext/node/polyfills/_next_tick.ts')
-rw-r--r--ext/node/polyfills/_next_tick.ts15
1 files changed, 3 insertions, 12 deletions
diff --git a/ext/node/polyfills/_next_tick.ts b/ext/node/polyfills/_next_tick.ts
index 5d895012e..5915c750e 100644
--- a/ext/node/polyfills/_next_tick.ts
+++ b/ext/node/polyfills/_next_tick.ts
@@ -5,10 +5,6 @@
// deno-lint-ignore-file prefer-primordials
import { core } from "ext:core/mod.js";
-import {
- getAsyncContext,
- setAsyncContext,
-} from "ext:runtime/01_async_context.js";
import { validateFunction } from "ext:deno_node/internal/validators.mjs";
import { _exiting } from "ext:deno_node/_process/exiting.ts";
@@ -17,7 +13,6 @@ import { FixedQueue } from "ext:deno_node/internal/fixed_queue.ts";
interface Tock {
callback: (...args: Array<unknown>) => void;
args: Array<unknown>;
- snapshot: unknown;
}
let nextTickEnabled = false;
@@ -28,7 +23,7 @@ export function enableNextTick() {
const queue = new FixedQueue();
export function processTicksAndRejections() {
- let tock: Tock;
+ let tock;
do {
// deno-lint-ignore no-cond-assign
while (tock = queue.shift()) {
@@ -36,11 +31,9 @@ export function processTicksAndRejections() {
// const asyncId = tock[async_id_symbol];
// emitBefore(asyncId, tock[trigger_async_id_symbol], tock);
- const oldContext = getAsyncContext();
try {
- setAsyncContext(tock.snapshot);
- const callback = tock.callback;
- if (tock.args === undefined) {
+ const callback = (tock as Tock).callback;
+ if ((tock as Tock).args === undefined) {
callback();
} else {
const args = (tock as Tock).args;
@@ -65,7 +58,6 @@ export function processTicksAndRejections() {
// FIXME(bartlomieju): Deno currently doesn't support async hooks
// if (destroyHooksExist())
// emitDestroy(asyncId);
- setAsyncContext(oldContext);
}
// FIXME(bartlomieju): Deno currently doesn't support async hooks
@@ -151,7 +143,6 @@ export function nextTick<T extends Array<unknown>>(
// FIXME(bartlomieju): Deno currently doesn't support async hooks
// [async_id_symbol]: asyncId,
// [trigger_async_id_symbol]: triggerAsyncId,
- snapshot: getAsyncContext(),
callback,
args: args_,
};