Files
f1-circuits/merge-check.sh
T
jschoubben 1e2c1b898f Keep Jolpica schedules, pace the requests, never keep a failure
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
2026-11-27 09:46:56 +01:00

29 lines
1.6 KiB
Bash

#!/bin/sh
# mesh-check-toolchain: go
#
# f1-circuits' own check (novox/hq ADR 0237): the second layer of a pull request's merge check,
# `mesh/repo-check`, run by the build seat in the mesh's Go toolchain, which carries Python for the merge
# checks that need it. The gate — the manifest through the controller the mesh runs, every machine
# composed with it — is the build seat's first layer (`mesh/merge-gate`), run because the mesh's module
# graph builds f1-circuits from this branch.
#
# What the image ships, compiled before the merge: every Python file the service's image copies, and the
# models it imports. Then the tests in tests/, which need the standard library only: every circuit in
# circuits/circuits.json carries one unique ergastId, and a race's circuit resolves by that id, never by
# its name; a failed Jolpica fetch is never kept, a season that is over is read from disk, a throttled
# request is asked again.
#
# **Said, never passed silently**: the service's dependencies (service/requirements.txt) are the image's to
# install, so the service is not started.
set -eu
# Parsed, not compiled to files: a check leaves the tree as it found it.
find cdn-api.py access_log.py circuits_service.py ergast_service.py posters_service.py models -name '*.py' -print0 |
xargs -0 python3 -c 'import ast, sys
for f in sys.argv[1:]:
ast.parse(open(f, encoding="utf-8").read(), f)
print(len(sys.argv) - 1, "Python file(s) parse")'
# -B: no bytecode written, the tree stays as it was found.
python3 -B -m unittest discover -s tests -t .
echo "NOT RUN HERE: the service (its dependencies are the image's to install)"