Forcefully exit on second term signal
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
b8c3703c2f
commit
b8bb40b9b6
6
app.js
6
app.js
@ -309,9 +309,15 @@ process.on('uncaughtException', function (err) {
|
|||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let alreadyHandlingTermSignals = false
|
||||||
// install exit handler
|
// install exit handler
|
||||||
function handleTermSignals () {
|
function handleTermSignals () {
|
||||||
|
if (alreadyHandlingTermSignals) {
|
||||||
|
logger.info('Forcefully exiting.')
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
logger.info('HedgeDoc has been killed by signal, try to exit gracefully...')
|
logger.info('HedgeDoc has been killed by signal, try to exit gracefully...')
|
||||||
|
alreadyHandlingTermSignals = true
|
||||||
realtime.maintenance = true
|
realtime.maintenance = true
|
||||||
// disconnect all socket.io clients
|
// disconnect all socket.io clients
|
||||||
Object.keys(io.sockets.sockets).forEach(function (key) {
|
Object.keys(io.sockets.sockets).forEach(function (key) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user