refactor(core): Implement a new OnPubSubEvent decorator (#15688)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-06-04 18:32:33 +02:00
committed by GitHub
parent b772462cea
commit 4b11268a6e
38 changed files with 610 additions and 1153 deletions

View File

@@ -1,3 +1,4 @@
import { OnPubSubEvent } from '@n8n/decorators';
import { Service } from '@n8n/di';
import type express from 'express';
import { InstanceSettings } from 'n8n-core';
@@ -168,6 +169,25 @@ export class TestWebhooks implements IWebhookManager {
});
}
@OnPubSubEvent('clear-test-webhooks', { instanceType: 'main' })
async handleClearTestWebhooks({
webhookKey,
workflowEntity,
pushRef,
}: {
webhookKey: string;
workflowEntity: IWorkflowBase;
pushRef: string;
}) {
if (!this.push.hasPushRef(pushRef)) return;
this.clearTimeout(webhookKey);
const workflow = this.toWorkflow(workflowEntity);
await this.deactivateWebhooks(workflow);
}
clearTimeout(key: string) {
const timeout = this.timeouts[key];