Do only one status request at a time
Currently we wait 5 seconds from the start of the request to do the next request. On openstack the request can take more than 5 seconds so we end up doing more requests in parallel. To fix this we should set the timer for the next request when receiving the response data. Change-Id: I543149f7f82cdd208cc50c30d1e29ea9a4cd453a
This commit is contained in:
parent
2200816ad5
commit
1aba9d1d5d
|
@ -98,8 +98,14 @@ class StatusPage extends React.Component {
|
|||
// .then(sleeper(2000))
|
||||
.then(response => {
|
||||
this.setState({status: response.data, loading: false})
|
||||
if (this.state.autoReload) {
|
||||
this.timer = setTimeout(this.updateData, 5000)
|
||||
}
|
||||
}).catch(error => {
|
||||
this.setState({error: error.message, status: null})
|
||||
if (this.state.autoReload) {
|
||||
this.timer = setTimeout(this.updateData, 5000)
|
||||
}
|
||||
})
|
||||
}
|
||||
// Clear any running timer
|
||||
|
@ -107,9 +113,6 @@ class StatusPage extends React.Component {
|
|||
clearTimeout(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
if (this.state.autoReload) {
|
||||
this.timer = setTimeout(this.updateData, 5000)
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount () {
|
||||
|
|
Loading…
Reference in New Issue