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

Commit

Permalink
feat: detect cluster restarts
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines authored and mergify[bot] committed Jun 27, 2019
1 parent 4f6d9e6 commit 4b46520
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class App extends React.Component {
}

componentDidMount() {
this.id = setInterval(() => this.updateClusterStats(), 1000);
this.id = setInterval(() => this.updateClusterStats(), 2000);
}

componentWillUnmount() {
Expand Down Expand Up @@ -112,11 +112,19 @@ class App extends React.Component {
this.trimTerminalOutput();
}

clusterRestart() {
this.addTerminalText(`Cluster restart detected at ${new Date()}`);
}

async updateClusterStats() {
try {
const transactionCount = await this.connection.getTransactionCount();
const totalSupply = await this.connection.getTotalSupply();

if (transactionCount < this.state.transactionCount) {
this.clusterRestart();
}

this.setState({
transactionCount,
totalSupply,
Expand Down

0 comments on commit 4b46520

Please sign in to comment.