mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
fix: Fix workflow deactivating bug
Fix a bug which crashed n8n under some circumstances on shutdown or workflow deactivate and so resulted in other workflows not getting deactviated correctly.
This commit is contained in:
parent
bb3fa05318
commit
195f104ef5
|
@ -255,7 +255,16 @@ export class ActiveWorkflows {
|
||||||
if (workflowData.triggerResponses) {
|
if (workflowData.triggerResponses) {
|
||||||
for (const triggerResponse of workflowData.triggerResponses) {
|
for (const triggerResponse of workflowData.triggerResponses) {
|
||||||
if (triggerResponse.closeFunction) {
|
if (triggerResponse.closeFunction) {
|
||||||
|
try {
|
||||||
await triggerResponse.closeFunction();
|
await triggerResponse.closeFunction();
|
||||||
|
} catch (error) {
|
||||||
|
Logger.error(
|
||||||
|
`There was a problem deactivating trigger of workflow "${id}": "${error.message}"`,
|
||||||
|
{
|
||||||
|
workflowId: id,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,7 +272,16 @@ export class ActiveWorkflows {
|
||||||
if (workflowData.pollResponses) {
|
if (workflowData.pollResponses) {
|
||||||
for (const pollResponse of workflowData.pollResponses) {
|
for (const pollResponse of workflowData.pollResponses) {
|
||||||
if (pollResponse.closeFunction) {
|
if (pollResponse.closeFunction) {
|
||||||
|
try {
|
||||||
await pollResponse.closeFunction();
|
await pollResponse.closeFunction();
|
||||||
|
} catch (error) {
|
||||||
|
Logger.error(
|
||||||
|
`There was a problem deactivating polling trigger of workflow "${id}": "${error.message}"`,
|
||||||
|
{
|
||||||
|
workflowId: id,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue