mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-01-11 05:51:32 +00:00
Forcefully exit on second term signal
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
b8c3703c2f
commit
b8bb40b9b6
1 changed files with 6 additions and 0 deletions
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…
Reference in a new issue