diff --git a/lib/node.js b/lib/node.js index 88be379..5c7bf97 100644 --- a/lib/node.js +++ b/lib/node.js @@ -2,6 +2,7 @@ var web3 = require('ethereum.js'); var _ = require('lodash'); var os = require('os'); var shelljs = require('shelljs'); +var debounce = require('debounce'); var Primus = require('primus'), Emitter = require('primus-emit'), @@ -386,7 +387,9 @@ Node.prototype.setWatches = function() this.chainFilter = web3.eth.filter('latest'); this.chainFilter.watch(function(log) { - self.update(); + debounce(function() { + self.update(); + }, 50); }); this.updateInterval = setInterval(function(){ diff --git a/package.json b/package.json index ead35a2..5ffd9eb 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "lib": "./lib" }, "dependencies": { + "debounce": "^1.0.0", "debug": "~2.1.3", "ethereum.js": "0.2.4", "lodash": "^3.6.0",