зеркало из https://github.com/microsoft/statsd.git
adding SIGTERM handling
This commit is contained in:
Родитель
8dadf9f232
Коммит
d6a8a3b8a2
12
stats.js
12
stats.js
|
@ -22,6 +22,7 @@ var pctThreshold = null;
|
|||
var flushInterval, keyFlushInt, server, mgmtServer;
|
||||
var startup_time = Math.round(new Date().getTime() / 1000);
|
||||
var backendEvents = new events.EventEmitter();
|
||||
var healthStatus = config.healthStatus || 'up';
|
||||
|
||||
// Load and init the backend from the backends/ directory.
|
||||
function loadBackend(config, name) {
|
||||
|
@ -234,7 +235,6 @@ config.configFile(process.argv[2], function (config, oldConfig) {
|
|||
});
|
||||
|
||||
mgmtServer = net.createServer(function(stream) {
|
||||
var healthStatus = config.healthStatus || 'up';
|
||||
stream.setEncoding('ascii');
|
||||
|
||||
stream.on('error', function(err) {
|
||||
|
@ -415,3 +415,13 @@ config.configFile(process.argv[2], function (config, oldConfig) {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
process.on('SIGTERM', function() {
|
||||
if (config.debug) {
|
||||
l.log('Going Down in ' + flushInterval + 'ms');
|
||||
}
|
||||
healthStatus = 'down';
|
||||
setTimeout(function() {
|
||||
process.exit();
|
||||
}, flushInterval);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче