mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
fix(core): Replace throw with warning when deactivating a non-active workflow (#6969)
Replaces a throw with a warning message instead, since the failure in question is not serious enough to warrant stopping the application.
This commit is contained in:
parent
6422078a5d
commit
b6a00febbd
|
@ -920,8 +920,10 @@ export class ActiveWorkflowRunner implements IWebhookManager {
|
||||||
// if it's active in memory then it's a trigger
|
// if it's active in memory then it's a trigger
|
||||||
// so remove from list of actives workflows
|
// so remove from list of actives workflows
|
||||||
if (this.activeWorkflows.isActive(workflowId)) {
|
if (this.activeWorkflows.isActive(workflowId)) {
|
||||||
await this.activeWorkflows.remove(workflowId);
|
const removalSuccess = await this.activeWorkflows.remove(workflowId);
|
||||||
Logger.verbose(`Successfully deactivated workflow "${workflowId}"`, { workflowId });
|
if (removalSuccess) {
|
||||||
|
Logger.verbose(`Successfully deactivated workflow "${workflowId}"`, { workflowId });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,12 +197,13 @@ export class ActiveWorkflows {
|
||||||
*
|
*
|
||||||
* @param {string} id The id of the workflow to deactivate
|
* @param {string} id The id of the workflow to deactivate
|
||||||
*/
|
*/
|
||||||
async remove(id: string): Promise<void> {
|
async remove(id: string): Promise<boolean> {
|
||||||
if (!this.isActive(id)) {
|
if (!this.isActive(id)) {
|
||||||
// Workflow is currently not registered
|
// Workflow is currently not registered
|
||||||
throw new Error(
|
Logger.warn(
|
||||||
`The workflow with the id "${id}" is currently not active and can so not be removed`,
|
`The workflow with the id "${id}" is currently not active and can so not be removed`,
|
||||||
);
|
);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const workflowData = this.workflowData[id];
|
const workflowData = this.workflowData[id];
|
||||||
|
@ -244,5 +245,7 @@ export class ActiveWorkflows {
|
||||||
}
|
}
|
||||||
|
|
||||||
delete this.workflowData[id];
|
delete this.workflowData[id];
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue