mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
⚡ Do not allow shorter polling-times than 1 minute
This commit is contained in:
parent
a800a84078
commit
e327bfcb91
|
@ -127,7 +127,7 @@ export class ActiveWorkflows {
|
||||||
for (const item of pollTimes.item) {
|
for (const item of pollTimes.item) {
|
||||||
cronTime = [];
|
cronTime = [];
|
||||||
if (item.mode === 'custom') {
|
if (item.mode === 'custom') {
|
||||||
cronTimes.push(item.cronExpression as string);
|
cronTimes.push((item.cronExpression as string).trim());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (item.mode === 'everyMinute') {
|
if (item.mode === 'everyMinute') {
|
||||||
|
@ -178,6 +178,11 @@ export class ActiveWorkflows {
|
||||||
// Start the cron-jobs
|
// Start the cron-jobs
|
||||||
const cronJobs: CronJob[] = [];
|
const cronJobs: CronJob[] = [];
|
||||||
for (const cronTime of cronTimes) {
|
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));
|
cronJobs.push(new CronJob(cronTime, executeTrigger, undefined, true, timezone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue