re-added pending filter

This commit is contained in:
cubedro 2015-05-05 01:00:01 +03:00
parent 76b4870c90
commit 019507a44f
1 changed files with 29 additions and 28 deletions

View File

@ -542,8 +542,6 @@ Node.prototype.updateBlock = function()
{
this.getStatsBlock();
this.update(true);
return this;
};
@ -613,34 +611,34 @@ Node.prototype.setWatches = function()
console.error(err);
}
// try {
// this.pendingFilter = web3.eth.filter('pending');
// this.pendingFilter.watch( function (log)
// {
// var now = _.now();
// var time = now - self._lastPendingLog;
try {
this.pendingFilter = web3.eth.filter('pending');
this.pendingFilter.watch( function (log)
{
var now = _.now();
var time = now - self._lastPendingLog;
// console.log('>>> Pending Filter triggered: ', now);
console.log('>>> Pending Filter triggered: ', now);
// if(time > 50)
// {
// self.update();
// }
// else
// {
// debounce(function() {
// self.update();
// }, 50);
// }
if(time > 50)
{
self.update(true);
}
else
{
debounce(function() {
self.update(true);
}, 50);
}
// self._lastPendingLog = now;
// });
// }
// catch (err)
// {
// console.error("Couldn't set up pending filter");
// console.error(err);
// }
self._lastPendingLog = now;
});
}
catch (err)
{
console.error("Couldn't set up pending filter");
console.error(err);
}
this.updateInterval = setInterval( function(){
self.update();
@ -678,8 +676,11 @@ Node.prototype.init = function()
// Set filters
this.setWatches();
// Update stats and send info
// Update block and send info
this.updateBlock();
// Update stats and send info
this.update();
}
Node.prototype.stop = function()