Fix peers not displaying (#3561)

* Add peers count to status polling

* Array destruct for better readability
This commit is contained in:
Nicolas Gotchac 2016-11-21 20:44:07 +01:00 committed by Jaco Greeff
parent eb94eda30b
commit 8a1b585da2

View File

@ -155,24 +155,20 @@ export default class Status {
const { refreshStatus } = this._store.getState().nodeStatus; const { refreshStatus } = this._store.getState().nodeStatus;
const statusPromises = [ this._api.eth.syncing() ]; const statusPromises = [ this._api.eth.syncing(), this._api.parity.netPeers() ];
if (refreshStatus) { if (refreshStatus) {
statusPromises.push(this._api.eth.hashrate()); statusPromises.push(this._api.eth.hashrate());
statusPromises.push(this._api.parity.netPeers());
} }
Promise Promise
.all(statusPromises) .all(statusPromises)
.then((statusResults) => { .then(([ syncing, netPeers, ...statusResults ]) => {
const status = statusResults.length === 1 const status = statusResults.length === 0
? { ? { syncing, netPeers }
syncing: statusResults[0]
}
: { : {
syncing: statusResults[0], syncing, netPeers,
hashrate: statusResults[1], hashrate: statusResults[0]
netPeers: statusResults[2]
}; };
if (!isEqual(status, this._status)) { if (!isEqual(status, this._status)) {