Pass a 'removed' parameter to node close handler

This commit is contained in:
Nick O'Leary
2017-04-21 23:36:21 +01:00
parent e13d410b4a
commit 4ea33ea482
5 changed files with 60 additions and 21 deletions

View File

@@ -121,7 +121,7 @@ function Flow(global,flow) {
}
}
this.stop = function(stopList) {
this.stop = function(stopList, removedList) {
return when.promise(function(resolve) {
var i;
if (stopList) {
@@ -135,6 +135,13 @@ function Flow(global,flow) {
} else {
stopList = Object.keys(activeNodes);
}
// Convert the list to a map to avoid multiple scans of the list
var removedMap = {};
removedList = removedList || [];
removedList.forEach(function(id) {
removedMap[id] = true;
});
var promises = [];
for (i=0;i<stopList.length;i++) {
var node = activeNodes[stopList[i]];
@@ -144,7 +151,7 @@ function Flow(global,flow) {
delete subflowInstanceNodes[stopList[i]];
}
try {
var p = node.close();
var p = node.close(removedMap[stopList[i]]);
if (p) {
promises.push(p);
}