From d96ea7c5e4481b5d6b08a98a2c2c9fc7a2a5078a Mon Sep 17 00:00:00 2001 From: Pratik Naik Date: Thu, 26 Feb 2015 15:52:45 -0600 Subject: Never stop attempting to reconnect --- lib/assets/javascripts/cable.js.coffee | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'lib/assets/javascripts/cable.js.coffee') diff --git a/lib/assets/javascripts/cable.js.coffee b/lib/assets/javascripts/cable.js.coffee index 2b34c1b447..07f6ba2284 100644 --- a/lib/assets/javascripts/cable.js.coffee +++ b/lib/assets/javascripts/cable.js.coffee @@ -2,7 +2,6 @@ #= require_tree . class @Cable - MAX_CONNECTION_ATTEMPTS: 10 MAX_CONNECTION_INTERVAL: 5 * 1000 PING_STALE_INTERVAL: 6 @@ -53,11 +52,8 @@ class @Cable @disconnected() setTimeout => - if @isMaxConnectionAttemptsReached() - @giveUp() - else - @incrementConnectionAttemptsCount() - @connect() + @incrementConnectionAttemptsCount() + @connect() , @generateReconnectInterval() resetConnectionAttemptsCount: => @@ -66,9 +62,6 @@ class @Cable incrementConnectionAttemptsCount: => @connectionAttempts += 1 - isMaxConnectionAttemptsReached: => - @connectionAttempts > @MAX_CONNECTION_ATTEMPTS - generateReconnectInterval: () -> interval = (Math.pow(2, @connectionAttempts) - 1) * 1000 if interval > @MAX_CONNECTION_INTERVAL then @MAX_CONNECTION_INTERVAL else interval -- cgit v1.2.3