From 1fc8cc44c339ace4b7eed6f326088c5ac2d3b7c6 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 4 Feb 2020 11:14:14 +0000 Subject: [PATCH 1/2] log shutdown messages as warnings --- services/real-time/app.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/real-time/app.coffee b/services/real-time/app.coffee index c2f9e7fa9c..3379d3e73b 100644 --- a/services/real-time/app.coffee +++ b/services/real-time/app.coffee @@ -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 From e263d3747665f8dac2cde9bb10e9856b6d67c77c Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Tue, 4 Feb 2020 11:14:53 +0000 Subject: [PATCH 2/2] pass the signal correctly to the shutdown handler --- services/real-time/app.coffee | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/services/real-time/app.coffee b/services/real-time/app.coffee index 3379d3e73b..074d384665 100644 --- a/services/real-time/app.coffee +++ b/services/real-time/app.coffee @@ -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