fix(wildlife): treat a valid empty Acartia snapshot as a fresh success

A quiet or fully filtered feed raised invalid_snapshot, so the proxy
answered 502 with a 15 s cooldown and re-polled about four times a
minute. Only a non-array payload is malformed now; an empty projection
caches for the normal ten minutes and clears earlier rows.
This commit is contained in:
Sameh Khamis committed 2026-11-05 16:03:52 -08:00
1 parent bd99000433
commit 82138478d0
3 files changed
+68 -25

No files matched your search

+3 -1
View File
@@ -100,7 +100,9 @@ export function acartiaProxy({
signal,
);
const rows = normalizeAcartiaSightings(payload, now());
if (!rows?.length) throw new Error('invalid_snapshot');
// Only a non-array is malformed. A quiet feed, or one whose rows all fall
// outside coverage or the species checks, is a valid empty snapshot.
if (!rows) throw new Error('invalid_snapshot');
return { fetchedAt: now(), rows };
} catch (error) {
if (error.status !== 429) coolDown(502, FAILURE_COOLDOWN_MS);