Fix aborted configuration requests being retried
This commit is contained in:
parent
c5f8644587
commit
0bdd4b3d44
@ -57,6 +57,11 @@ export default defineComponent({
|
|||||||
startUpdates();
|
startUpdates();
|
||||||
requestAnimationFrame(() => window.hideSplash());
|
requestAnimationFrame(() => window.hideSplash());
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
//Request was aborted, probably because another server was selected before the request finished. Don't retry
|
||||||
|
if(e instanceof DOMException && e.name === 'AbortError') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const error = `Failed to load server configuration for '${store.state.currentServer}'`;
|
const error = `Failed to load server configuration for '${store.state.currentServer}'`;
|
||||||
console.error(`${error}:`, e);
|
console.error(`${error}:`, e);
|
||||||
window.showSplashError(`${error}\n${e}`, false, ++configAttempts.value);
|
window.showSplashError(`${error}\n${e}`, false, ++configAttempts.value);
|
||||||
@ -75,6 +80,10 @@ export default defineComponent({
|
|||||||
await store.dispatch(ActionTypes.GET_UPDATE, undefined);
|
await store.dispatch(ActionTypes.GET_UPDATE, undefined);
|
||||||
} finally {
|
} finally {
|
||||||
if(updatesEnabled.value) {
|
if(updatesEnabled.value) {
|
||||||
|
if(updateTimeout.value) {
|
||||||
|
clearTimeout(updateTimeout.value);
|
||||||
|
}
|
||||||
|
|
||||||
updateTimeout.value = setTimeout(() => update(), updateInterval.value);
|
updateTimeout.value = setTimeout(() => update(), updateInterval.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -653,7 +653,8 @@ async function fetchJSON(url: string, signal: AbortSignal) {
|
|||||||
response = await fetch(url, {signal});
|
response = await fetch(url, {signal});
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
if(e instanceof DOMException && e.name === 'AbortError') {
|
if(e instanceof DOMException && e.name === 'AbortError') {
|
||||||
console.warn('Request aborted');
|
console.warn(`Request aborted (${url}`);
|
||||||
|
throw e;
|
||||||
} else {
|
} else {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user