Merge pull request #191 from cubedro/develop

Performance improvements
This commit is contained in:
Marian OANCΞA 2015-06-13 13:02:35 +03:00
commit be4aca5f19
6 changed files with 33 additions and 12 deletions

10
app.js
View File

@ -288,16 +288,16 @@ api.on('connection', function (spark)
if(latency !== null)
{
client.write({
action: 'latency',
data: latency
});
// client.write({
// action: 'latency',
// data: latency
// });
console.info('API', 'PIN', 'Latency:', latency, 'from:', data.id);
}
});
if( Nodes.requiresUpdate(data.id) && !Nodes.askedForHistory() )
if( Nodes.requiresUpdate(data.id) )
{
var range = Nodes.getHistory().getHistoryRequestRange();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -287,7 +287,7 @@ Collection.prototype.canNodeUpdate = function(id)
Collection.prototype.requiresUpdate = function(id)
{
return ( this.canNodeUpdate(id) && this._blockchain.requiresUpdate() );
return ( this.canNodeUpdate(id) && this._blockchain.requiresUpdate() && (!this._askedForHistory || _.now() - this._askedForHistoryTime > 2*60*1000) );
}
Collection.prototype.askedForHistory = function(set)

View File

@ -290,7 +290,8 @@ Node.prototype.getStats = function()
block: this.stats.block,
propagationAvg: this.stats.propagationAvg,
uptime: this.stats.uptime,
pending: this.stats.pending
pending: this.stats.pending,
latency: this.stats.latency
},
history: this.history
};
@ -316,7 +317,8 @@ Node.prototype.getBasicStats = function()
hashrate: this.stats.hashrate,
peers: this.stats.peers,
gasPrice: this.stats.gasPrice,
uptime: this.stats.uptime
uptime: this.stats.uptime,
latency: this.stats.latency
}
};
}

View File

@ -35,7 +35,7 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc
$scope.latency = 0;
$scope.currentApiVersion = "0.0.13";
$scope.currentApiVersion = "0.0.14";
$scope.predicate = $localStorage.predicate || ['-pinned', '-stats.active', '-stats.block.number', 'stats.block.propagation'];
$scope.reverse = $localStorage.reverse || false;
@ -93,7 +93,7 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc
var timeout = setInterval(function ()
{
$scope.$apply();
}, 200);
}, 300);
$scope.getNumber = function (num) {
return new Array(num);
@ -206,6 +206,13 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc
$scope.nodes[index].stats = data.stats;
if( !_.isUndefined(data.stats.latency) && _.get($scope.nodes[index], 'stats.latency', 0) !== data.stats.latency )
{
$scope.nodes[index].stats.latency = data.stats.latency;
latencyFilter($scope.nodes[index]);
}
updateBestBlock();
}
@ -268,6 +275,13 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc
$scope.nodes[index].stats.gasPrice = data.stats.gasPrice;
$scope.nodes[index].stats.uptime = data.stats.uptime;
if( !_.isUndefined(data.stats.latency) && _.get($scope.nodes[index], 'stats.latency', 0) !== data.stats.latency )
{
$scope.nodes[index].stats.latency = data.stats.latency;
latencyFilter($scope.nodes[index]);
}
updateActiveNodes();
}
}
@ -555,6 +569,11 @@ netStatsApp.controller('StatsCtrl', function($scope, $filter, $localStorage, soc
if( _.isUndefined(node.readable) )
node.readable = {};
node.readable.forkClass = 'hidden';
node.readable.forkMessage = '';
return true;
if( $scope.chains[node.stats.block.number].fork === node.stats.block.fork && $scope.chains[node.stats.block.number].score / $scope.maxScore >= 0.5 )
{
node.readable.forkClass = 'hidden';