From 60adbaf4af97dc4aa9cd3a96058e0c94f642e911 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Mon, 31 Aug 2015 08:14:17 -0500 Subject: Increment style --- lib/assets/javascripts/cable/connection_monitor.js.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/assets/javascripts/cable/connection_monitor.js.coffee b/lib/assets/javascripts/cable/connection_monitor.js.coffee index c6949971fb..30ce11957c 100644 --- a/lib/assets/javascripts/cable/connection_monitor.js.coffee +++ b/lib/assets/javascripts/cable/connection_monitor.js.coffee @@ -20,8 +20,7 @@ class Cable.ConnectionMonitor @pingedAt = now() disconnected: -> - if @reconnectAttempts is 0 - @reconnectAttempts += 1 + if @reconnectAttempts++ is 0 setTimeout => @consumer.connection.open() unless @consumer.connection.isOpen() , 200 @@ -57,7 +56,7 @@ class Cable.ConnectionMonitor reconnectIfStale: -> if @connectionIsStale() - @reconnectAttempts += 1 + @reconnectAttempts++ @consumer.connection.reopen() connectionIsStale: -> -- cgit v1.2.3