From b1918093c56e85874eb9a2a4cfd04d5c29b626ef Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Wed, 6 May 2026 17:09:12 -0400 Subject: [PATCH 1/2] pass parallel option down to startPolling --- src/taskSchema.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/taskSchema.js b/src/taskSchema.js index b5ddf41..eb7c43f 100644 --- a/src/taskSchema.js +++ b/src/taskSchema.js @@ -121,9 +121,11 @@ taskSchema.statics.startPolling = function startPolling(options) { const interval = options?.interval ?? 1000; const workerName = options?.workerName; const getCurrentTime = options?.getCurrentTime; + const parallel = options?.parallel; const pollOptions = { ...(workerName ? { workerName } : {}), - ...(getCurrentTime ? { getCurrentTime } : {}) + ...(getCurrentTime ? { getCurrentTime } : {}), + ...(parallel != null ? { parallel } : {}) }; let cancelled = false; let timeout = null; From 0d7003e86dfa7c01f29c6d4951c673fc21ba6d56 Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Wed, 6 May 2026 18:07:30 -0400 Subject: [PATCH 2/2] validate that parallel is a positive number --- src/taskSchema.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/taskSchema.js b/src/taskSchema.js index eb7c43f..18e7db7 100644 --- a/src/taskSchema.js +++ b/src/taskSchema.js @@ -122,6 +122,9 @@ taskSchema.statics.startPolling = function startPolling(options) { 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 } : {}),