fix(access): the bootstrap request gets an 8 s time limit
A bootstrap request that never answered (seen on the Android emulator after a cold start with the server down) left the app on its loading screen for good: no error, so no retry. It now times out, counts as offline (cached bootstrap / offline screen) and is retried, so the app comes back by itself when the server does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,7 @@ import { OverrideHost } from './OverrideHost.jsx'
|
|||||||
* error with Retry.
|
* error with Retry.
|
||||||
*/
|
*/
|
||||||
const CACHE_RETRY_MS = 15_000
|
const CACHE_RETRY_MS = 15_000
|
||||||
|
const BOOTSTRAP_TIMEOUT_MS = 8_000
|
||||||
|
|
||||||
export function AccessProvider({
|
export function AccessProvider({
|
||||||
client, token = null, i18n, deviceLanguage, override = true, loading, autoRetryMs = 0, cache, failed, children,
|
client, token = null, i18n, deviceLanguage, override = true, loading, autoRetryMs = 0, cache, failed, children,
|
||||||
@@ -44,7 +45,9 @@ export function AccessProvider({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const { data } = await client.get('/api/platform/bootstrap', { xenia: { ignoreUnauthorized: true, noOverride: true } })
|
// a time limit: a request that never answers (a half-dead link) must not leave the app on
|
||||||
|
// its loading screen for good; it counts as offline and is retried (4.6, Android e2e)
|
||||||
|
const { data } = await client.get('/api/platform/bootstrap', { timeout: BOOTSTRAP_TIMEOUT_MS, xenia: { ignoreUnauthorized: true, noOverride: true } })
|
||||||
await apply(data)
|
await apply(data)
|
||||||
try { cache?.save(token, data) } catch { /* storage full or blocked: still works online */ }
|
try { cache?.save(token, data) } catch { /* storage full or blocked: still works online */ }
|
||||||
setState({ data, forToken: token, error: null, offline: false })
|
setState({ data, forToken: token, error: null, offline: false })
|
||||||
|
|||||||
Reference in New Issue
Block a user