Skip to content

Commit

Permalink
refactor: use micro tasks queue instead next tick one
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
jerome-benoit committed Oct 26, 2024
1 parent 717c9cf commit 95e17f6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/utils/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -334,8 +334,8 @@ export const isArraySorted = <T>(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
})
}

0 comments on commit 95e17f6

Please sign in to comment.