fix(core): Protect against duplicate cron registration (#18005)

This commit is contained in:
Iván Ovejero
2025-08-06 15:35:52 +02:00
committed by GitHub
parent 32f47948d6
commit 948ebe6702
11 changed files with 264 additions and 98 deletions

View File

@@ -5,6 +5,7 @@ import type {
INodeType,
INodeTypeDescription,
ITriggerResponse,
Cron,
} from 'n8n-workflow';
import { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';
@@ -451,7 +452,10 @@ export class ScheduleTrigger implements INodeType {
if (this.getMode() !== 'manual') {
for (const { interval, cronExpression, recurrence } of rules) {
try {
const cron = { expression: cronExpression, recurrence };
const cron: Cron = {
expression: cronExpression,
recurrence,
};
this.helpers.registerCron(cron, () => executeTrigger(recurrence));
} catch (error) {
if (interval.field === 'cronExpression') {