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

Commit

Permalink
fix: switch to setTimeout() to avoid running updates concurrently
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Apr 29, 2019
1 parent 4e50de6 commit eaaceac
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,15 +180,7 @@ class App extends Component {
const self = this;

self.updateGlobalStats();
setInterval(() => {
self.updateGlobalStats();
}, 1200);

self.updateTxnStats();
setInterval(() => {
self.updateTxnStats();
}, 22000);

self.updateBlocks();

self.updateTransactions();
Expand Down Expand Up @@ -268,13 +260,16 @@ class App extends Component {
this.setState({nodes: []});
console.log('getClusterNodes failed:', err.message);
}

setTimeout(() => this.updateGlobalStats(), 1200);
}

updateTxnStats() {
this.getRemoteState(
'txnStats',
`http:${BLOCK_EXPLORER_API_BASE}/txn-stats`,
);
setTimeout(() => this.updateTxnStats(), 22000);
}

updateBlocks() {
Expand Down

0 comments on commit eaaceac

Please sign in to comment.