added PENDING_WORKS flag
This commit is contained in:
parent
1adb7700db
commit
4361ea9d4b
@ -30,6 +30,7 @@ if(process.env.NODE_ENV === 'production' && INSTANCE_NAME === "")
|
|||||||
var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000');
|
var socket = new Socket(process.env.WS_SERVER || 'ws://localhost:3000');
|
||||||
var WS_SECRET = process.env.WS_SECRET || "eth-net-stats-has-a-secret";
|
var WS_SECRET = process.env.WS_SECRET || "eth-net-stats-has-a-secret";
|
||||||
|
|
||||||
|
var PENDING_WORKS = true;
|
||||||
var MAX_BLOCKS_HISTORY = 36;
|
var MAX_BLOCKS_HISTORY = 36;
|
||||||
var UPDATE_INTERVAL = 5000;
|
var UPDATE_INTERVAL = 5000;
|
||||||
var PING_INTERVAL = 2000;
|
var PING_INTERVAL = 2000;
|
||||||
@ -307,11 +308,15 @@ Node.prototype.getStats = function()
|
|||||||
if(this.stats.block.number > 0)
|
if(this.stats.block.number > 0)
|
||||||
this.getLatestBlocks();
|
this.getLatestBlocks();
|
||||||
|
|
||||||
|
if(PENDING_WORKS) {
|
||||||
try {
|
try {
|
||||||
this.stats.pending = web3.eth.getBlockTransactionCount('pending');
|
this.stats.pending = web3.eth.getBlockTransactionCount('pending');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
PENDING_WORKS = false;
|
||||||
console.error("getBlockTransactionCount('pending'):", err);
|
console.error("getBlockTransactionCount('pending'):", err);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.stats.mining = web3.eth.mining;
|
this.stats.mining = web3.eth.mining;
|
||||||
this.stats.gasPrice = web3.eth.gasPrice.toString(10);
|
this.stats.gasPrice = web3.eth.gasPrice.toString(10);
|
||||||
this.stats.listening = web3.net.listening;
|
this.stats.listening = web3.net.listening;
|
||||||
|
Loading…
Reference in New Issue
Block a user