mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
fix(core): Fix issue that "closeFunction" got called twice
This commit is contained in:
parent
02cdec1416
commit
1910299a88
|
@ -134,22 +134,24 @@ export class ActiveWorkflowRunner {
|
||||||
* @memberof ActiveWorkflowRunner
|
* @memberof ActiveWorkflowRunner
|
||||||
*/
|
*/
|
||||||
async removeAll(): Promise<void> {
|
async removeAll(): Promise<void> {
|
||||||
const activeWorkflowId: string[] = [];
|
let activeWorkflowIds: string[] = [];
|
||||||
Logger.verbose('Call to remove all active workflows received (removeAll)');
|
Logger.verbose('Call to remove all active workflows received (removeAll)');
|
||||||
|
|
||||||
if (this.activeWorkflows !== null) {
|
if (this.activeWorkflows !== null) {
|
||||||
// TODO: This should be renamed!
|
activeWorkflowIds.push.apply(activeWorkflowIds, this.activeWorkflows.allActiveWorkflows());
|
||||||
activeWorkflowId.push.apply(activeWorkflowId, this.activeWorkflows.allActiveWorkflows());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const activeWorkflows = await this.getActiveWorkflows();
|
const activeWorkflows = await this.getActiveWorkflows();
|
||||||
activeWorkflowId.push.apply(
|
activeWorkflowIds = [
|
||||||
activeWorkflowId,
|
...activeWorkflowIds,
|
||||||
activeWorkflows.map((workflow) => workflow.id),
|
...activeWorkflows.map((workflow) => workflow.id.toString()),
|
||||||
);
|
];
|
||||||
|
|
||||||
|
// Make sure IDs are unique
|
||||||
|
activeWorkflowIds = Array.from(new Set(activeWorkflowIds));
|
||||||
|
|
||||||
const removePromises = [];
|
const removePromises = [];
|
||||||
for (const workflowId of activeWorkflowId) {
|
for (const workflowId of activeWorkflowIds) {
|
||||||
removePromises.push(this.remove(workflowId));
|
removePromises.push(this.remove(workflowId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue