mirror of
https://github.com/node-red/node-red
synced 2024-11-23 08:59:13 +00: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 () {
|
||||
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();
|
||||
});
|
||||
|
13
red/nodes.js
13
red/nodes.js
@ -271,16 +271,17 @@ module.exports.getNode = function(nid) {
|
||||
return registry.get(nid);
|
||||
}
|
||||
|
||||
module.exports.closedown = function() {
|
||||
util.log("[red] Closing Down Nodes");
|
||||
registry.clear();
|
||||
}
|
||||
|
||||
module.exports.setConfig = function(conf) {
|
||||
function stopFlows() {
|
||||
if (activeConfig&&activeConfig.length > 0) {
|
||||
util.log("[red] Stopping flows");
|
||||
}
|
||||
registry.clear();
|
||||
}
|
||||
|
||||
module.exports.stopFlows = stopFlows;
|
||||
|
||||
module.exports.setConfig = function(conf) {
|
||||
stopFlows();
|
||||
activeConfig = conf;
|
||||
parseConfig();
|
||||
}
|
||||
|
@ -33,10 +33,10 @@ var RED = {
|
||||
},
|
||||
|
||||
start: server.start,
|
||||
stop: server.stop,
|
||||
nodes: nodes,
|
||||
library: library,
|
||||
events: events,
|
||||
stop: nodes.closedown,
|
||||
events: events
|
||||
};
|
||||
|
||||
RED.__defineGetter__("app", function() { return server.app });
|
||||
|
@ -101,9 +101,14 @@ function start() {
|
||||
});
|
||||
}
|
||||
|
||||
function stop() {
|
||||
redNodes.stopFlows();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
init: createServer,
|
||||
start: start
|
||||
start: start,
|
||||
stop: stop
|
||||
}
|
||||
|
||||
module.exports.__defineGetter__("app", function() { return app });
|
||||
|
Loading…
Reference in New Issue
Block a user