Преглед изворни кода

reject connections when shutdown in progress

send a message to the client to reconnect immediately
Brian Gough пре 7 година
родитељ
комит
0708f717fd
1 измењених фајлова са 5 додато и 0 уклоњено
  1. 5 0
      services/real-time/app/coffee/Router.coffee

+ 5 - 0
services/real-time/app/coffee/Router.coffee

@@ -39,6 +39,11 @@ module.exports = Router =
 		app.post "/drain", httpAuth, HttpApiController.startDrain
 		app.post "/drain", httpAuth, HttpApiController.startDrain
 
 
 		session.on 'connection', (error, client, session) ->
 		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/)
 			if client? and error?.message?.match(/could not look up session by key/)
 				logger.warn err: error, client: client?, session: session?, "invalid session"
 				logger.warn err: error, client: client?, session: session?, "invalid session"
 				# tell the client to reauthenticate if it has an invalid session key
 				# tell the client to reauthenticate if it has an invalid session key