mirror of https://github.com/mthenw/frontail.git
Fix runtime stats sending
parent
28de6d18dc
commit
c35287ce7a
5
index.js
5
index.js
|
@ -157,8 +157,9 @@ if (program.daemonize) {
|
|||
* Handle signals
|
||||
*/
|
||||
const cleanExit = () => {
|
||||
stats.timeEnd('runtime', 'runtime');
|
||||
process.exit();
|
||||
stats.timeEnd('runtime', 'runtime', () => {
|
||||
process.exit();
|
||||
});
|
||||
};
|
||||
process.on('SIGINT', cleanExit);
|
||||
process.on('SIGTERM', cleanExit);
|
||||
|
|
|
@ -54,12 +54,12 @@ Stats.prototype.time = function time(category, action) {
|
|||
this.timer[category][action] = Date.now();
|
||||
};
|
||||
|
||||
Stats.prototype.timeEnd = function timeEnd(category, action) {
|
||||
Stats.prototype.timeEnd = function timeEnd(category, action, cb) {
|
||||
if (!this.tracker) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.tracker.timing(category, action, Date.now() - this.timer[category][action]).send();
|
||||
this.tracker.timing(category, action, Date.now() - this.timer[category][action]).send(cb);
|
||||
};
|
||||
|
||||
module.exports = enabled => new Stats(enabled);
|
||||
|
|
Loading…
Reference in New Issue