change auto disconnect to 24 hours and expose it publicly for easier testing

This commit is contained in:
Henry Oswald 2015-10-15 11:38:23 +01:00
parent 2f48568f76
commit bbe510099e

View file

@ -2,6 +2,9 @@ define [], () ->
ONEHOUR = 1000 * 60 * 60 ONEHOUR = 1000 * 60 * 60
class ConnectionManager class ConnectionManager
disconnectAfterMs: ONEHOUR * 24
lastUserAction : new Date() lastUserAction : new Date()
constructor: (@ide, @$scope) -> constructor: (@ide, @$scope) ->
@ -161,7 +164,7 @@ define [], () ->
setTimeout (=> @startAutoReconnectCountdown() if !@connected), 2000 setTimeout (=> @startAutoReconnectCountdown() if !@connected), 2000
disconnectIfInactive: ()-> disconnectIfInactive: ()->
@userIsInactive = (new Date() - @lastUserAction) > ONEHOUR * 12 @userIsInactive = (new Date() - @lastUserAction) > @disconnectAfterMs
if @userIsInactive and @connected if @userIsInactive and @connected
@disconnect() @disconnect()
@$scope.$apply () => @$scope.$apply () =>