feat: add SIGTERM to safe shutdown feature
This commit is contained in:
parent
6a3a47a13d
commit
675b4f5a3a
1 changed files with 3 additions and 2 deletions
|
@ -221,7 +221,8 @@ io.on('connection', function (socket) {
|
|||
})
|
||||
})
|
||||
|
||||
process.on('SIGINT', function () {
|
||||
const signals = ['SIGTERM', 'SIGINT']
|
||||
signals.forEach(signal => process.on(signal, function () {
|
||||
if (shutdownMode) stop('Safe shutdown aborted, force quitting')
|
||||
else if (connectionCount > 0) {
|
||||
var remainingSeconds = config.safeShutdownDuration
|
||||
|
@ -241,7 +242,7 @@ process.on('SIGINT', function () {
|
|||
}
|
||||
}, 1000)
|
||||
} else stop()
|
||||
})
|
||||
}))
|
||||
|
||||
// clean stop
|
||||
function stop (reason) {
|
||||
|
|
Loading…
Reference in a new issue