1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Ensure all subflow instances are stopped when flow stopping

Fixes #2095
This commit is contained in:
Nick O'Leary 2019-03-15 09:13:32 +00:00
parent 6fe2b24592
commit afa69f4c0e
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -247,6 +247,7 @@ class Flow {
if (!stopList) { if (!stopList) {
stopList = Object.keys(this.activeNodes); stopList = Object.keys(this.activeNodes);
} }
// this.trace(" stopList: "+stopList.join(","))
// Convert the list to a map to avoid multiple scans of the list // Convert the list to a map to avoid multiple scans of the list
var removedMap = {}; var removedMap = {};
removedList = removedList || []; removedList = removedList || [];
@ -261,8 +262,9 @@ class Flow {
delete this.activeNodes[stopList[i]]; delete this.activeNodes[stopList[i]];
if (this.subflowInstanceNodes[stopList[i]]) { if (this.subflowInstanceNodes[stopList[i]]) {
try { try {
var subflow = this.subflowInstanceNodes[stopList[i]]; (function(subflow) {
promises.push(stopNode(node,false).then(() => { subflow.stop() })); promises.push(stopNode(node,false).then(() => { subflow.stop() }));
})(this.subflowInstanceNodes[stopList[i]]);
} catch(err) { } catch(err) {
node.error(err); node.error(err);
} }