From 95e17f676b7c1067ce40de914335e35afb862df8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 26 Oct 2024 23:11:36 +0200 Subject: [PATCH] refactor: use micro tasks queue instead next tick one MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/utils/Utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 6acb470b..5ebe17ea 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -12,7 +12,7 @@ import { secondsToMilliseconds, } from 'date-fns' import { getRandomValues, randomBytes, randomUUID } from 'node:crypto' -import { env, nextTick } from 'node:process' +import { env } from 'node:process' import { is, isNotEmpty, type NonEmptyArray, type ReadonlyNonEmptyArray } from 'rambda' import { @@ -334,8 +334,8 @@ export const isArraySorted = (array: T[], compareFn: (a: T, b: T) => number): return true } -export const throwErrorInNextTick = (error: Error): void => { - nextTick(() => { +export const queueMicrotaskErrorThrowing = (error: Error): void => { + queueMicrotask(() => { throw error }) } -- 2.34.1