Use callback properly
This commit is contained in:
parent
f2b5921ade
commit
ce04cbcb45
5
app.js
5
app.js
@ -133,8 +133,9 @@ process.on('SIGTERM', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
global.logger.info('Exit gracefully');
|
global.logger.info('Exit gracefully');
|
||||||
server.batch.logger.end();
|
server.batch.logger.end(function () {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -56,13 +56,13 @@ class Logger {
|
|||||||
//
|
//
|
||||||
// See: https://github.com/trentm/node-bunyan/issues/37
|
// See: https://github.com/trentm/node-bunyan/issues/37
|
||||||
// See: https://github.com/trentm/node-bunyan/issues/73
|
// See: https://github.com/trentm/node-bunyan/issues/73
|
||||||
end () {
|
end (callback) {
|
||||||
// process.stdout cannot be closed
|
// process.stdout cannot be closed
|
||||||
if (!this.path) {
|
if (!this.path) {
|
||||||
return;
|
return callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.streams[0].stream.on('finish', resolve);
|
this.logger.streams[0].stream.on('finish', callback);
|
||||||
this.logger.streams[0].stream.end(); // close stream, flush buffer to disk
|
this.logger.streams[0].stream.end(); // close stream, flush buffer to disk
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user