added chain filter dobounce
This commit is contained in:
parent
092f859e60
commit
3e82d5aad5
18
lib/node.js
18
lib/node.js
@ -105,6 +105,7 @@ function Node ()
|
|||||||
this._socket = false;
|
this._socket = false;
|
||||||
|
|
||||||
this._latestQueue = null;
|
this._latestQueue = null;
|
||||||
|
this._chainDebouncer = 0;
|
||||||
this.pendingFilter = false;
|
this.pendingFilter = false;
|
||||||
this.chainFilter = false;
|
this.chainFilter = false;
|
||||||
this.updateInterval = false;
|
this.updateInterval = false;
|
||||||
@ -666,7 +667,24 @@ Node.prototype.setWatches = function()
|
|||||||
|
|
||||||
console.info('>>>', 'Chain Filter triggered: ', chalk.reset.red(hash), '- last trigger:', chalk.reset.cyan(time));
|
console.info('>>>', 'Chain Filter triggered: ', chalk.reset.red(hash), '- last trigger:', chalk.reset.cyan(time));
|
||||||
|
|
||||||
|
if(time < 5)
|
||||||
|
{
|
||||||
|
this._chainDebouncer++;
|
||||||
|
} else {
|
||||||
|
this._chainDebouncer = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this._chainDebouncer < 20)
|
||||||
|
{
|
||||||
self._latestQueue.push(hash);
|
self._latestQueue.push(hash);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
debounce(function() {
|
||||||
|
self._latestQueue.push(hash);
|
||||||
|
self._chainDebouncer = 0;
|
||||||
|
}, 5);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.success("Installed chain filter");
|
console.success("Installed chain filter");
|
||||||
|
Loading…
Reference in New Issue
Block a user