Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix peers not displaying (#3561)
Browse files Browse the repository at this point in the history
* Add peers count to status polling

* Array destruct for better readability
  • Loading branch information
ngotchac authored and jacogr committed Nov 21, 2016
1 parent eb94eda commit 8a1b585
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions js/src/redux/providers/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,24 +155,20 @@ export default class Status {

const { refreshStatus } = this._store.getState().nodeStatus;

const statusPromises = [ this._api.eth.syncing() ];
const statusPromises = [ this._api.eth.syncing(), this._api.parity.netPeers() ];

if (refreshStatus) {
statusPromises.push(this._api.eth.hashrate());
statusPromises.push(this._api.parity.netPeers());
}

Promise
.all(statusPromises)
.then((statusResults) => {
const status = statusResults.length === 1
? {
syncing: statusResults[0]
}
.then(([ syncing, netPeers, ...statusResults ]) => {
const status = statusResults.length === 0
? { syncing, netPeers }
: {
syncing: statusResults[0],
hashrate: statusResults[1],
netPeers: statusResults[2]
syncing, netPeers,
hashrate: statusResults[0]
};

if (!isEqual(status, this._status)) {
Expand Down

0 comments on commit 8a1b585

Please sign in to comment.