reject connections when shutdown in progress

send a message to the client to reconnect immediately
This commit is contained in:
Brian Gough 2019-08-13 16:59:15 +01:00
parent 53431953fc
commit 0708f717fd

View file

@ -39,6 +39,11 @@ module.exports = Router =
app.post "/drain", httpAuth, HttpApiController.startDrain
session.on 'connection', (error, client, session) ->
if settings.shutDownInProgress
client.emit("connectionRejected", {message: "retry"})
client.disconnect()
return
if client? and error?.message?.match(/could not look up session by key/)
logger.warn err: error, client: client?, session: session?, "invalid session"
# tell the client to reauthenticate if it has an invalid session key