fix(core): Return correct trigger count for nodes with multiple webhooks (#14300)

Co-authored-by: Danny Martini <danny@n8n.io>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Marc Littlemore
2025-04-04 14:15:10 +01:00
committed by GitHub
parent 480b44d024
commit 39e2d35a71
4 changed files with 82 additions and 14 deletions

View File

@@ -673,10 +673,23 @@ export class ActiveWorkflowManager {
const triggerFilter = (nodeType: INodeType) =>
!!nodeType.trigger && !nodeType.description.name.includes('manualTrigger');
// Retrieve unique webhooks as some nodes have multiple webhooks
const workflowWebhooks = WebhookHelpers.getWorkflowWebhooks(
workflow,
additionalData,
undefined,
true,
);
const uniqueWebhooks = workflowWebhooks.reduce<Set<string>>((acc, webhook) => {
acc.add(webhook.node);
return acc;
}, new Set());
return (
workflow.queryNodes(triggerFilter).length +
workflow.getPollNodes().length +
WebhookHelpers.getWorkflowWebhooks(workflow, additionalData, undefined, true).length
uniqueWebhooks.size
);
}