diff --git a/src/taskSchema.js b/src/taskSchema.js index b5ddf41..18e7db7 100644 --- a/src/taskSchema.js +++ b/src/taskSchema.js @@ -121,9 +121,14 @@ taskSchema.statics.startPolling = function startPolling(options) { const interval = options?.interval ?? 1000; const workerName = options?.workerName; const getCurrentTime = options?.getCurrentTime; + const parallel = options?.parallel; + if (parallel != null && (typeof parallel !== 'number' || parallel <= 0)) { + throw new Error('Invalid parallel option, must be a positive number'); + } const pollOptions = { ...(workerName ? { workerName } : {}), - ...(getCurrentTime ? { getCurrentTime } : {}) + ...(getCurrentTime ? { getCurrentTime } : {}), + ...(parallel != null ? { parallel } : {}) }; let cancelled = false; let timeout = null;