mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-11 00:57:18 +00:00
Merge pull request #89 from overleaf/bg-improve-shutdown-logging
improve shutdown logging
This commit is contained in:
commit
d12e056f08
1 changed files with 5 additions and 6 deletions
|
@ -111,17 +111,17 @@ Error.stackTraceLimit = 10
|
|||
shutdownCleanly = (signal) ->
|
||||
connectedClients = io.sockets.clients()?.length
|
||||
if connectedClients == 0
|
||||
logger.log("no clients connected, exiting")
|
||||
logger.warn("no clients connected, exiting")
|
||||
process.exit()
|
||||
else
|
||||
logger.log {connectedClients}, "clients still connected, not shutting down yet"
|
||||
logger.warn {connectedClients}, "clients still connected, not shutting down yet"
|
||||
setTimeout () ->
|
||||
shutdownCleanly(signal)
|
||||
, 10000
|
||||
, 30 * 1000
|
||||
|
||||
drainAndShutdown = (signal) ->
|
||||
if Settings.shutDownInProgress
|
||||
logger.log signal: signal, "shutdown already in progress, ignoring signal"
|
||||
logger.warn signal: signal, "shutdown already in progress, ignoring signal"
|
||||
return
|
||||
else
|
||||
Settings.shutDownInProgress = true
|
||||
|
@ -135,8 +135,7 @@ if Settings.shutdownDrainTimeWindow?
|
|||
shutdownDrainTimeWindow = parseInt(Settings.shutdownDrainTimeWindow, 10)
|
||||
logger.log shutdownDrainTimeWindow: shutdownDrainTimeWindow,"shutdownDrainTimeWindow enabled"
|
||||
for signal in ['SIGINT', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGABRT']
|
||||
process.on signal, ->
|
||||
drainAndShutdown(signal)
|
||||
process.on signal, drainAndShutdown # signal is passed as argument to event handler
|
||||
|
||||
# global exception handler
|
||||
if Settings.errors?.catchUncaughtErrors
|
||||
|
|
Loading…
Add table
Reference in a new issue