mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Implement a new OnPubSubEvent decorator (#15688)
This commit is contained in:
committed by
GitHub
parent
b772462cea
commit
4b11268a6e
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user