fix(adsbdb): 720/min by default, configurable, and a 429 is not an answer

The cap becomes GEV_RATELIMIT_ADSBDB_PER_MIN with a 720 default, read
through resolvePerMinuteCap like the other cost limiters (0 disables, an
unreadable value takes the default). On a 429 both enrichment queues make
the key askable again after the error's retry-after, so the next request
for that aircraft is dispatched instead of dropped.
This commit is contained in:
daikaginza committed 2026-10-23 12:39:32 +07:00
1 parent b83e1a2c98
commit 80b2ead154
7 files changed
+78 -31

No files matched your search

+9 -3
View File
@@ -21,7 +21,7 @@ export function createEnrichment({
if (flightState.lifetime.signal.aborted) return;
if (flightState._enrichSeen.has(key)) return;
flightState._enrichSeen.add(key);
const job = { query, onData };
const job = { key, query, onData };
// Priority (tracked / model-eligible) goes to the FRONT so a deep ambient
// backlog can never delay the plane the user just clicked or zoomed into.
if (priority) flightState._enrichQueue.unshift(job);
@@ -64,8 +64,14 @@ export function createEnrichment({
.then((data) => {
if (!lifetime.signal.aborted && data && data.found) job.onData(data);
})
.catch(() => {
/* enrichment never surfaces errors */
.catch((error) => {
// Enrichment never surfaces errors. A 429 is not an answer, though:
// the key becomes askable again once the refusal has passed.
if (error?.code === 'limited')
setTimeout(() => {
if (!lifetime.signal.aborted)
flightState._enrichSeen.delete(job.key);
}, error.retryAfterMs);
})
.finally(() => {
if (lifetime.signal.aborted) return;