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) shutdownCleanly(signal)
, 10000 , 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 shutDownInProgress = false
if Settings.forceDrainMsDelay? if Settings.shutdownDrainTimeWindow?
Settings.forceDrainMsDelay = parseInt(Settings.forceDrainMsDelay, 10) Settings.forceDrainMsDelay = parseInt(Settings.shutdownDrainTimeWindow, 10)
logger.log forceDrainMsDelay: Settings.forceDrainMsDelay,"forceDrainMsDelay enabled" logger.log shutdownDrainTimeWindow: Settings.shutdownDrainTimeWindow,"shutdownDrainTimeWindow enabled"
for signal in ['SIGINT', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGABRT'] for signal in ['SIGINT', 'SIGHUP', 'SIGQUIT', 'SIGUSR1', 'SIGUSR2', 'SIGTERM', 'SIGABRT']
process.on signal, -> process.on signal, ->
if shutDownInProgress if shutDownInProgress
@ -128,9 +121,9 @@ if Settings.forceDrainMsDelay?
return return
else else
shutDownInProgress = true 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) shutdownCleanly(signal)
forceDrain()

View file

@ -48,8 +48,6 @@ settings =
max_doc_length: 2 * 1024 * 1024 # 2mb 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 shutdownDrainTimeWindow: process.env['SHUTDOWN_DRAIN_TIME_WINDOW'] or 9
continualPubsubTraffic: process.env['CONTINUAL_PUBSUB_TRAFFIC'] or false continualPubsubTraffic: process.env['CONTINUAL_PUBSUB_TRAFFIC'] or false