added pending as a separate call

This commit is contained in:
cubedro
2015-06-01 21:42:50 +03:00
parent 34d23a06a3
commit 54eacc4a9a
6 changed files with 65 additions and 6 deletions

View File

@@ -39,6 +39,16 @@ Collection.prototype.update = function(id, stats)
return node.setStats(stats, propagationHistory);
}
Collection.prototype.updatePending = function(id, stats)
{
var node = this.getNode({ id: id });
if (!node)
return false;
return node.setPending(stats);
}
Collection.prototype.addHistory = function(id, blocks)
{
var node = this.getNode({ id: id });

View File

@@ -130,6 +130,9 @@ Node.prototype.setStats = function(stats, history)
else
stats.propagationAvg = 0;
if( !_.isUndefined(this.stats.latency) )
stats.latency = this.stats.latency;
this.stats = stats;
return this.getStats();
@@ -138,6 +141,21 @@ Node.prototype.setStats = function(stats, history)
return false;
}
Node.prototype.setPending = function(stats)
{
if( !_.isUndefined(stats) && !_.isUndefined(stats.pending) )
{
this.stats.pending = stats.pending;
return {
id: this.id,
pending: this.stats.pending
};
}
return false;
}
Node.prototype.setLatency = function(latency)
{
if( !_.isUndefined(latency) )