fix(server): charge the track limiter for upstream calls only and stop replaying stale errors

A cached answer or a malformed request costs OpenSky nothing, so neither
is charged to the 30/min window. During a /tracks cooldown only a cached
track is replayed; an old cached error gives way to the cooldown refusal.
The 429 that arms the cooldown is no longer cached, so it and its repeats
carry Retry-After. No token is minted unless the upstream is called.
This commit is contained in:
Said Turksever committed 2026-11-23 01:23:44 +00:00
1 parent 2eef8cd902
commit 7ba53f6d0e
4 files changed
+135 -21

No files matched your search

@@ -1,6 +1,7 @@
- Stop the OpenSky track-backfill proxy from turning a varied `icao24` into
unbounded upstream spend. `/api/flights/track` carries an always-on
30-per-minute per-client limiter (90 global), and a
30-per-minute per-client limiter (90 global) on upstream calls (a cached
answer or a malformed request is not charged), and a
`429` from OpenSky `/tracks/all` now starts a cooldown for that credit
bucket: until OpenSky's retry-after passes, any cached track is served and
other lookups are answered `429` locally instead of asking for 4 more