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

@@ -2,9 +2,12 @@
cache eviction, so a caller cycling through the callsign or hex keyspace
could drive unlimited live requests at the free community API and grow
`.gev-cache/adsbdb.json` without end — every distinct key, 404s included, was
remembered forever. The route now admits 360 requests/minute per client
address (the browser's own drip cannot exceed 300), refusing the rest with
429 and `Retry-After` before any cache, disk or upstream work. Each cache
holds at most 20,000 entries, dropping the least-recently-written first, and
entries past the existing 24-hour TTL are discarded when the file is read
back. Cached answers and response shapes are unchanged (daikaginza, #689).
remembered forever. The route now admits 720 requests/minute per client
address (`GEV_RATELIMIT_ADSBDB_PER_MIN`; one tab's two enrichment queues top
out at 600), refusing the rest with 429 and `Retry-After` before any cache,
disk or upstream work. A refused lookup is asked for again once the refusal
has passed instead of leaving that aircraft without metadata for the
session. Each cache holds at most 20,000 entries, dropping the
least-recently-written first, and entries past the existing 24-hour TTL are
discarded when the file is read back. Cached answers and response shapes are
unchanged (daikaginza, #689).