From 4b46520f98cb235db223338595e5481c2f0940c3 Mon Sep 17 00:00:00 2001 From: Michael Vines Date: Thu, 27 Jun 2019 15:18:52 -0700 Subject: [PATCH] feat: detect cluster restarts --- src/app.jsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app.jsx b/src/app.jsx index 840193b..24ba541 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -63,7 +63,7 @@ class App extends React.Component { } componentDidMount() { - this.id = setInterval(() => this.updateClusterStats(), 1000); + this.id = setInterval(() => this.updateClusterStats(), 2000); } componentWillUnmount() { @@ -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,