use FORCE_DRAIN_MS_DELAY

This commit is contained in:
Henry Oswald 2018-12-04 14:31:07 +00:00
parent 2418e5db57
commit 05611de15e
2 changed files with 5 additions and 6 deletions

View file

@ -96,15 +96,14 @@ shutdownCleanly = (signal) ->
, 10000
forceDrain = ->
THREE_HOURS = 60 * 1000 * 60 * 3
logger.log {delay_ms:THREE_HOURS}, "starting force drain after timeout"
forceDrainMsDelay = parseInt(Settings.forceDrainMsDelay, 10)
logger.log {delay_ms:forceDrainMsDelay}, "starting force drain after timeout"
setTimeout ()->
logger.log "starting drain"
DrainManager.startDrain(io, 4)
, THREE_HOURS
, Settings.forceDrainMsDelay
if Settings.delayExitUntilDrained
if Settings.forceDrainMsDelay?
logger.log "drainBeforeShutdown enabled"
for signal in ['SIGINT', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGABRT']
logger.log signal: signal, "received interrupt, cleaning up"

View file

@ -42,4 +42,4 @@ module.exports =
max_doc_length: 2 * 1024 * 1024 # 2mb
delayExitUntilDrained: process.env['DELAY_EXIT_UNTIL_DRAINED'] or false
forceDrainMsDelay: process.env['FORCE_DRAIN_MS_DELAY'] or false