mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
fix(status): stop false LOAD FAILED from a relayed adsb.lol 429 and the installations zoom prompt
Two independent triggers turned the global status chip red while every layer was still populated (reproduced at JFK in Cockpit; timeline in the issue). adsb.lol proxy: a non-OK upstream status was relayed verbatim even with a 12 s-old cache in hand, and the browser layer answers a 429 with a 45 s cooldown in which every refresh reports "adsb.lol rate limited" without a network call. The proxy now serves its cached body as STALE on a 429/5xx and backs off from upstream for Retry-After (bounded), mirroring the OpenSky proxy. A failure with nothing cached is still relayed. Mapped installations: the "zoom in" guidance was stored in `error`, so the manager reported a refresh failure and the chip a LOAD FAILED whenever the view could not be bounded (Cockpit looks at the horizon). The status is now set without an error string; the row reads the prompt from `statusMessage`, and the chip ignores `error` for guidance statuses, matching the carve-out layerFeedState already has.
This commit is contained in:
1 parent
db49edf363
commit
1a9cfb1809
8 files changed
+200
-21
No files matched your search
@@ -5,6 +5,8 @@ export const LOADING_TERMINAL_DWELL_MS = 2200;
|
||||
export const LOADING_FAILURE_DWELL_MS = 5000;
|
||||
export const LOADING_LONG_THRESHOLD_MS = 30000;
|
||||
export const TRAFFIC_SYNC_CONFIRM_MS = 1500;
|
||||
/** Layer statuses that are user guidance, not feed faults (see manager.js layerFeedState). */
|
||||
export const GUIDANCE_STATUSES = Object.freeze(['zoom-in', 'empty', 'idle']);
|
||||
|
||||
function finiteCount(value) {
|
||||
const number = Number(value);
|
||||
@@ -20,7 +22,13 @@ export function normalizeLayerLoading(layer = {}) {
|
||||
const loading = lifecycleState === 'enabling' || disabling || stats.loading === true || stats.refreshing === true;
|
||||
const count = finiteCount(stats.count);
|
||||
const stoppingInstallations = layer.id === 'military-installations' && disabling;
|
||||
const error = stoppingInstallations ? null : stats.error || stats.lastError || stats.managerRefreshError || null;
|
||||
// Guidance statuses ask the user to act (zoom in, run a search). They are
|
||||
// normal operation, never a batch failure — mirrors layerFeedState's carve-out
|
||||
// so a prompt stored alongside the status cannot turn the chip red.
|
||||
const guidance = GUIDANCE_STATUSES.includes(status);
|
||||
const error = stoppingInstallations || guidance
|
||||
? null
|
||||
: stats.error || stats.lastError || stats.managerRefreshError || null;
|
||||
const unavailable = !stoppingInstallations && (stats.unavailable === true
|
||||
|| stats.available === false
|
||||
|| ['unavailable', 'offline', 'down', 'error'].includes(status));
|
||||
|
||||
Reference in new issue
Block a user