diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2015-02-26 15:52:45 -0600 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2015-02-26 15:52:45 -0600 |
commit | d96ea7c5e4481b5d6b08a98a2c2c9fc7a2a5078a (patch) | |
tree | d831f827b56547d1faf520d1b7bf5902b69956aa /lib | |
parent | 359f006bac5318fa3f61b2c20f45bd7ec90b0de1 (diff) | |
download | rails-d96ea7c5e4481b5d6b08a98a2c2c9fc7a2a5078a.tar.gz rails-d96ea7c5e4481b5d6b08a98a2c2c9fc7a2a5078a.tar.bz2 rails-d96ea7c5e4481b5d6b08a98a2c2c9fc7a2a5078a.zip |
Never stop attempting to reconnect
Diffstat (limited to 'lib')
-rw-r--r-- | lib/assets/javascripts/cable.js.coffee | 11 |
1 files changed, 2 insertions, 9 deletions
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 |