mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 10:31:15 +00:00
refactor(core): Delete some duplicate code between ActiveWebhooks and ActiveWorkflowRunner (no-changelog) (#6951)
This commit is contained in:
committed by
GitHub
parent
9b27878d8f
commit
41c3cc89ca
@@ -63,25 +63,13 @@ export class ActiveWebhooks {
|
||||
this.webhookUrls[webhookKey].push(webhookData);
|
||||
|
||||
try {
|
||||
const webhookExists = await workflow.runWebhookMethod(
|
||||
'checkExists',
|
||||
await workflow.createWebhookIfNotExists(
|
||||
webhookData,
|
||||
NodeExecuteFunctions,
|
||||
mode,
|
||||
activation,
|
||||
this.testWebhooks,
|
||||
);
|
||||
if (webhookExists !== true) {
|
||||
// If webhook does not exist yet create it
|
||||
await workflow.runWebhookMethod(
|
||||
'create',
|
||||
webhookData,
|
||||
NodeExecuteFunctions,
|
||||
mode,
|
||||
activation,
|
||||
this.testWebhooks,
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
// If there was a problem unregister the webhook again
|
||||
if (this.webhookUrls[webhookKey].length <= 1) {
|
||||
@@ -183,8 +171,7 @@ export class ActiveWebhooks {
|
||||
// Go through all the registered webhooks of the workflow and remove them
|
||||
|
||||
for (const webhookData of webhooks) {
|
||||
await workflow.runWebhookMethod(
|
||||
'delete',
|
||||
await workflow.deleteWebhook(
|
||||
webhookData,
|
||||
NodeExecuteFunctions,
|
||||
mode,
|
||||
|
||||
Reference in New Issue
Block a user