From e327bfcb917f0f72511312eb463de2623e138c55 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Thu, 12 Nov 2020 12:42:04 +0100 Subject: [PATCH] :zap: Do not allow shorter polling-times than 1 minute --- packages/core/src/ActiveWorkflows.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/core/src/ActiveWorkflows.ts b/packages/core/src/ActiveWorkflows.ts index 2e3b6d7c12..86a88c617b 100644 --- a/packages/core/src/ActiveWorkflows.ts +++ b/packages/core/src/ActiveWorkflows.ts @@ -127,7 +127,7 @@ export class ActiveWorkflows { for (const item of pollTimes.item) { cronTime = []; if (item.mode === 'custom') { - cronTimes.push(item.cronExpression as string); + cronTimes.push((item.cronExpression as string).trim()); continue; } if (item.mode === 'everyMinute') { @@ -178,6 +178,11 @@ export class ActiveWorkflows { // Start the cron-jobs const cronJobs: CronJob[] = []; for (const cronTime of cronTimes) { + const cronTimeParts = cronTime.split(' '); + if (cronTimeParts.length > 0 && cronTimeParts[0].includes('*')) { + throw new Error('The polling interval is too short. It has to be at least a minute!'); + } + cronJobs.push(new CronJob(cronTime, executeTrigger, undefined, true, timezone)); }