mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Bit more of a shuffle round of the shutdown handling
This commit is contained in:
parent
e60120f7c9
commit
eb9b31a21b
3
red.js
3
red.js
@ -72,6 +72,7 @@ process.on('uncaughtException',function(err) {
|
|||||||
|
|
||||||
process.on('SIGINT', function () {
|
process.on('SIGINT', function () {
|
||||||
RED.stop();
|
RED.stop();
|
||||||
util.log('[red] Exiting Node-RED. Thank you.');
|
// TODO: need to allow nodes to close asynchronously before terminating the
|
||||||
|
// process - ie, promises
|
||||||
process.exit();
|
process.exit();
|
||||||
});
|
});
|
||||||
|
13
red/nodes.js
13
red/nodes.js
@ -271,16 +271,17 @@ module.exports.getNode = function(nid) {
|
|||||||
return registry.get(nid);
|
return registry.get(nid);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.closedown = function() {
|
function stopFlows() {
|
||||||
util.log("[red] Closing Down Nodes");
|
|
||||||
registry.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports.setConfig = function(conf) {
|
|
||||||
if (activeConfig&&activeConfig.length > 0) {
|
if (activeConfig&&activeConfig.length > 0) {
|
||||||
util.log("[red] Stopping flows");
|
util.log("[red] Stopping flows");
|
||||||
}
|
}
|
||||||
registry.clear();
|
registry.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.stopFlows = stopFlows;
|
||||||
|
|
||||||
|
module.exports.setConfig = function(conf) {
|
||||||
|
stopFlows();
|
||||||
activeConfig = conf;
|
activeConfig = conf;
|
||||||
parseConfig();
|
parseConfig();
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ var RED = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
start: server.start,
|
start: server.start,
|
||||||
|
stop: server.stop,
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
library: library,
|
library: library,
|
||||||
events: events,
|
events: events
|
||||||
stop: nodes.closedown,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
RED.__defineGetter__("app", function() { return server.app });
|
RED.__defineGetter__("app", function() { return server.app });
|
||||||
|
@ -101,9 +101,14 @@ function start() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stop() {
|
||||||
|
redNodes.stopFlows();
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: createServer,
|
init: createServer,
|
||||||
start: start
|
start: start,
|
||||||
|
stop: stop
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports.__defineGetter__("app", function() { return app });
|
module.exports.__defineGetter__("app", function() { return app });
|
||||||
|
Loading…
Reference in New Issue
Block a user