- }
-
- /**
- * Executes a function once at a time.
- *
- * @param fn - The function to execute.
- * @param context - The context to bind the function to.
- * @returns The function to execute.
- */
- private once (
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- fn: (...args: any[]) => void,
- context = this
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- ): (...args: any[]) => void {
- let called = false
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- return function (...args: any[]): void {
- if (!called) {
- called = true
- fn.apply(context, args)
- called = false
- }
+ if (tasksQueueBackPressureSize == null) {
+ throw new TypeError(
+ 'Cannot construct a worker node without a tasks queue back pressure size'
+ )
+ }
+ if (!Number.isSafeInteger(tasksQueueBackPressureSize)) {
+ throw new TypeError(
+ 'Cannot construct a worker node with a tasks queue back pressure size that is not an integer'
+ )
+ }
+ if (tasksQueueBackPressureSize <= 0) {
+ throw new RangeError(
+ 'Cannot construct a worker node with a tasks queue back pressure size that is not a positive integer'
+ )