better error handling
This commit is contained in:
parent
068133b021
commit
2fd2145d54
3
app.js
3
app.js
@ -82,6 +82,8 @@ api.on('connection', function(spark) {
|
|||||||
data.stats.latency = spark.latency;
|
data.stats.latency = spark.latency;
|
||||||
|
|
||||||
var stats = Nodes.update(data.id, data.stats);
|
var stats = Nodes.update(data.id, data.stats);
|
||||||
|
if(stats !== false)
|
||||||
|
{
|
||||||
client.write({action: 'update', data: stats});
|
client.write({action: 'update', data: stats});
|
||||||
|
|
||||||
var blockPropagationChart = Nodes.blockPropagationChart();
|
var blockPropagationChart = Nodes.blockPropagationChart();
|
||||||
@ -90,6 +92,7 @@ api.on('connection', function(spark) {
|
|||||||
var uncleCount = Nodes.getUncleCount();
|
var uncleCount = Nodes.getUncleCount();
|
||||||
client.write({action: 'uncleCount', data: uncleCount});
|
client.write({action: 'uncleCount', data: uncleCount});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
spark.on('node-ping', function(data){
|
spark.on('node-ping', function(data){
|
||||||
|
@ -27,6 +27,10 @@ Collection.prototype.update = function(id, stats)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
var block = this._history.add(stats.block, id);
|
var block = this._history.add(stats.block, id);
|
||||||
|
|
||||||
|
if(! block)
|
||||||
|
return false;
|
||||||
|
|
||||||
var propagationHistory = this._history.getNodePropagation(id);
|
var propagationHistory = this._history.getNodePropagation(id);
|
||||||
|
|
||||||
stats.block.arrived = block.arrived;
|
stats.block.arrived = block.arrived;
|
||||||
|
@ -32,6 +32,8 @@ var History = function History(data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
History.prototype.add = function(block, id)
|
History.prototype.add = function(block, id)
|
||||||
|
{
|
||||||
|
if(typeof block !== 'undefined' && typeof block.number !== 'undefined' && typeof block.uncles !== 'undefined' && typeof block.transactions !== 'undefined')
|
||||||
{
|
{
|
||||||
var historyBlock = this.search(block.number);
|
var historyBlock = this.search(block.number);
|
||||||
|
|
||||||
@ -76,6 +78,9 @@ History.prototype.add = function(block, id)
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
History.prototype._save = function(block)
|
History.prototype._save = function(block)
|
||||||
{
|
{
|
||||||
this._items.push(block);
|
this._items.push(block);
|
||||||
|
Loading…
Reference in New Issue
Block a user