Jolpica answers a season it has not served lately in over 10 s (13.5 s
for 2024 on 2026-11-27), so a cold fill timed out 18 seasons and the
Kometa file and the library page went without them until asked again
(found by the library page's test).
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
Review round 1 (two findings):
- While Jolpica failed, every schedule read asked it again, up to four
times per poster request, and the poster, thumb and grand-prix routes
were async, so the pacing, a 429's pause and a timeout stalled every
request. A failed ask is now remembered for ten minutes (the kept
schedule, or none, is answered meanwhile), a schedule in memory is
answered without waiting for an ask under way, and those routes are
plain defs in the threadpool. A rendered picture is stored whole
(written aside, then renamed), as two may now render it side by side.
- Bytecode was tracked: tests/__pycache__ (added with the tests) and
models/__pycache__ that the cleanup missed. Untracked; .gitignore
already names __pycache__/.
From the review's notes: a poster whose map or photo failed is sent with
a five-minute cache instead of a year's; uvicorn trusts the proxy's
forwarded headers, so /examples redirects to https, not http; stale
comments naming CARTO and the zoom lookup's key are corrected.
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
A Kometa YAML request asks Jolpica for every season at once; Jolpica
(4 requests a second, 500 an hour) answered 429 for 24 seasons on
2026-11-27 09:28, and lru_cache kept each failure as an empty schedule,
so every poster and thumb of those seasons answered 404 until a restart.
The service also ran two Jolpica clients, so the race lookup and the
posters held different schedules.
Now one client serves the whole service; a season that is over is kept
on disk in the cache volume for good, one not yet over is asked again
after six hours; requests are paced under the limit, a 429 is asked
again after its Retry-After; a failure is never kept. The Kometa
endpoint runs in the threadpool, as its first fill takes minutes.
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
Jolpica renamed Losail to Lusail International Circuit, so the name match
found no circuit and every Qatar Grand Prix poster, thumb and track image
answered 404 (reported by Brad Johnston for 2025 and 2026; every season
since 2021 failed). Names drift, ids do not: each circuit in circuits.json
now carries its ergastId, the lookup keys on it, and the poster's zoom
fallback resolves our circuit slug the same way. The name match also sent
Caesars Palace (1981-82) to the Las Vegas Strip circuit; by id it resolves
to nothing, as there is no layout of it.
tests/ checks every circuit has one unique ergastId and that a race
resolves by id; the merge check runs it.
Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
FastF1's get_event() couldn't resolve several grand prix names
(Qatar, Brazilian, Mexican, Barcelona), causing 500/404 errors.
Now uses Jolpica's race schedule directly — slugifies circuitName
to match against circuits.json with ASCII fallback for unicode.