Skip to content

Commit

Permalink
ui: Fix fetch interval
Browse files Browse the repository at this point in the history
  • Loading branch information
scpa1055 authored and cassava committed Apr 25, 2023
1 parent a1c4126 commit e91e768
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class App extends Component {
configData: {},
initialHost: "",
host: "",
updateInterval: 500,
updateInterval: 1000,
connected: false,
sideBarOpen: false,
dragNDropActivated: false,
Expand All @@ -91,7 +91,7 @@ class App extends Component {
this.jsonVersionChecked = false;
this.fetchCloeApi = 0;
this.bufferInterval = 0;
this.defaultUpdateInterval = 500;
this.defaultUpdateInterval = 1000;
// Definitions for the one-time fetched information.
this.controllers = [];
this.simulators = [];
Expand Down Expand Up @@ -523,18 +523,16 @@ class App extends Component {
axios
.get(`http://${this.state.host}`)
.then(() => {
// If connected set new interval.
this.renewFetchInterval(this.defaultUpdateInterval);
if (!this.state.connected) {
this.setState({ connected: true, startupPhase: 2 });
}
})
.catch(() => {
this.setState({ connected: false });
if (this.startupPhase === 2) {
if (this.state.startupPhase === 2) {
this.setState({ startupPhase: 1 });
}
if (this.startupPhase === 3) {
if (this.state.startupPhase === 3) {
this.setState({ startupPhase: 4 });
}
});
Expand Down Expand Up @@ -609,7 +607,7 @@ class App extends Component {
startupStepFour = () => {
if (this.state.connected) {
this.setState({ startupPhase: 2 });
this.renewFetchInterval(100);
this.renewFetchInterval(this.defaultUpdateInterval);
}
};

Expand Down

0 comments on commit e91e768

Please sign in to comment.