feat: inform user if engine is trying to reconnect
This commit is contained in:
parent
88c74e199f
commit
cc136c4c2c
@ -31,13 +31,13 @@ export async function fetchUpdate() {
|
|||||||
const last = this.lastFetched.splice(0, 1)
|
const last = this.lastFetched.splice(0, 1)
|
||||||
this.lastFetched.push(now)
|
this.lastFetched.push(now)
|
||||||
if (now.getTime() - last[0].getTime() < 1000) {
|
if (now.getTime() - last[0].getTime() < 1000) {
|
||||||
console.warn('engine: respawning too fast, throttling down')
|
console.warn('engine: respawning too fast, throttling down')
|
||||||
delay = 5000
|
delay = 5000
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.isConnected.value = false
|
this.isConnected.value = false
|
||||||
this.retry.value++
|
this.retry.value++
|
||||||
|
|
||||||
if (e.response) {
|
if (e.response) {
|
||||||
// callApi() threw an exception
|
// callApi() threw an exception
|
||||||
const { status, statusText } = e.response
|
const { status, statusText } = e.response
|
||||||
@ -55,6 +55,11 @@ export async function fetchUpdate() {
|
|||||||
} else {
|
} else {
|
||||||
// request aborted or other causes
|
// request aborted or other causes
|
||||||
console.warn(e.message)
|
console.warn(e.message)
|
||||||
|
|
||||||
|
this.retry.value = -1
|
||||||
|
this.isActive = false
|
||||||
|
this.shouldStop = false
|
||||||
|
console.debug('engine stopped')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<TopBar />
|
<TopBar />
|
||||||
<AlertBox v-if="!isConnected" mode="alert">
|
<AlertBox v-if="!isConnected" mode="alert">
|
||||||
connection to server broken
|
connection to server broken
|
||||||
<div>retrying {{'...'.slice(0, retry % 4)}}</div>
|
<div v-if="retry >= 0">retrying {{'...'.slice(0, retry % 4)}}</div>
|
||||||
</AlertBox>
|
</AlertBox>
|
||||||
wohoo!
|
wohoo!
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user