server stop timeout

This commit is contained in:
Jan Prochazka 2021-12-28 17:59:05 +01:00
parent fd54c176eb
commit 1e59182fda

View File

@ -127,10 +127,14 @@ function start() {
function shutdown() {
console.log('\nShutting down DbGate API server');
server.close( ()=> {
server.close(() => {
console.log('Server shut down, terminating');
process.exit(0);
});
setTimeout(() => {
console.log('Server close timeout, terminating');
process.exit(0);
}, 1000);
}
process.on('SIGINT', shutdown);