From 2776a713572b4b0de5c1c721da7110f27b33b78c Mon Sep 17 00:00:00 2001 From: cubedro Date: Fri, 12 Jun 2015 22:46:47 +0300 Subject: [PATCH] don't uninstall ping interval --- lib/node.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/node.js b/lib/node.js index 31f9b87..a018746 100644 --- a/lib/node.js +++ b/lib/node.js @@ -176,7 +176,7 @@ Node.prototype.checkWeb3Connection = function() Node.prototype.reconnectWeb3 = function() { - console.info("Web3 reconnect attempts started"); + console.warn("Uninstalling filters and update interval"); this._web3 = false; this._connection_attempts = 0; @@ -184,9 +184,6 @@ Node.prototype.reconnectWeb3 = function() if(this.updateInterval) clearInterval(this.updateInterval); - if(this.pingInterval) - clearInterval(this.pingInterval); - try { web3.reset(); @@ -196,6 +193,8 @@ Node.prototype.reconnectWeb3 = function() console.error("Web3 reset error:", err); } + console.info("Web3 reconnect attempts started"); + this.checkWeb3Connection(); } @@ -781,9 +780,12 @@ Node.prototype.setWatches = function() self.getStats(); }, UPDATE_INTERVAL); - this.pingInterval = setInterval( function(){ - self.ping(); - }, PING_INTERVAL); + if( !this.pingInterval ) + { + this.pingInterval = setInterval( function(){ + self.ping(); + }, PING_INTERVAL); + } } Node.prototype.init = function()