remove forceDrainMsDelay

as soon as a pod is marked as being killed we should start draining
This commit is contained in:
Henry Oswald 2019-08-14 11:51:25 +01:00
parent 00cca29d9e
commit 4a984f533e
2 changed files with 5 additions and 14 deletions

View file

@ -110,17 +110,10 @@ shutdownCleanly = (signal) ->
shutdownCleanly(signal)
, 10000
forceDrain = ->
logger.log {delay_ms:Settings.forceDrainMsDelay}, "starting force drain after timeout"
setTimeout ()->
logger.log "starting drain over #{Settings.shutdownDrainTimeWindow} mins"
DrainManager.startDrainTimeWindow(io, Settings.shutdownDrainTimeWindow)
, Settings.forceDrainMsDelay
shutDownInProgress = false
if Settings.forceDrainMsDelay?
Settings.forceDrainMsDelay = parseInt(Settings.forceDrainMsDelay, 10)
logger.log forceDrainMsDelay: Settings.forceDrainMsDelay,"forceDrainMsDelay enabled"
if Settings.shutdownDrainTimeWindow?
Settings.forceDrainMsDelay = parseInt(Settings.shutdownDrainTimeWindow, 10)
logger.log shutdownDrainTimeWindow: Settings.shutdownDrainTimeWindow,"shutdownDrainTimeWindow enabled"
for signal in ['SIGINT', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGABRT']
process.on signal, ->
if shutDownInProgress
@ -128,9 +121,9 @@ if Settings.forceDrainMsDelay?
return
else
shutDownInProgress = true
logger.log signal: signal, "received interrupt, cleaning up"
logger.log signal: signal, "received interrupt, starting drain over #{Settings.shutdownDrainTimeWindow} mins"
DrainManager.startDrainTimeWindow(io, Settings.shutdownDrainTimeWindow)
shutdownCleanly(signal)
forceDrain()

View file

@ -48,8 +48,6 @@ settings =
max_doc_length: 2 * 1024 * 1024 # 2mb
forceDrainMsDelay: process.env['FORCE_DRAIN_MS_DELAY'] or false
shutdownDrainTimeWindow: process.env['SHUTDOWN_DRAIN_TIME_WINDOW'] or 9
continualPubsubTraffic: process.env['CONTINUAL_PUBSUB_TRAFFIC'] or false