X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fworker%2Futils.ts;h=d0883893581b0a14c24cb415bef585541b71c446;hb=refs%2Fheads%2Fmaster;hp=b5c1725a776572116cef3e51a0c9e477d43c45d6;hpb=bcfb06ce041a682baf396a099c633a848d6a4045;p=poolifier.git diff --git a/src/worker/utils.ts b/src/worker/utils.ts index b5c1725a..59a0289b 100644 --- a/src/worker/utils.ts +++ b/src/worker/utils.ts @@ -1,4 +1,7 @@ -import { checkValidWorkerChoiceStrategy } from '../pools/utils.js' +import { + checkValidPriority, + checkValidWorkerChoiceStrategy, +} from '../pools/utils.js' import { isPlainObject } from '../utils.js' import type { TaskFunctionObject } from './task-functions.js' import { KillBehaviors, type WorkerOptions } from './worker-options.js' @@ -54,11 +57,7 @@ export const checkValidTaskFunctionObjectEntry = < `taskFunction object 'taskFunction' property '${fnObj.taskFunction}' is not a function` ) } - if (fnObj.priority != null && !Number.isSafeInteger(fnObj.priority)) { - throw new TypeError( - `taskFunction object 'priority' property '${fnObj.priority}' is not an integer` - ) - } + checkValidPriority(fnObj.priority) checkValidWorkerChoiceStrategy(fnObj.strategy) }