feat: durable cache so finished sessions survive restarts - #44
Merged
Merged
Conversation
OpenF1's free tier locks out all access (past sessions included) for a stretch around every live session. Finished sessions were already kept in memory so a lockout couldn't blank them, but a restart wiped that - a deploy landing during a lockout left the tyre and latest-session tiles empty until it lifted. - cache: getDurable/setDurable keep never-changing data in memory and, when CACHE_DIR is set, mirror it to disk as small JSON files (atomic write, ignored after 30 days). tyre_usage and latest_session use it for finished sessions; anything else immutable can too. - image: /data owned by the non-root user, CACHE_DIR=/data by default - mount a volume there to persist; without one it still works, it just doesn't outlive the container. - startup probes the directory and logs a warning if it isn't writable, instead of silently not persisting. - README, docker-compose example. Verified in the real scratch image: fresh named volume and no volume both start clean; a read-only mount logs the warning.
JustMaris
added a commit
that referenced
this pull request
Sep 26, 2026
OpenF1's free tier locks out all access (past sessions included) for a stretch around every live session. Finished sessions were already kept in memory so a lockout couldn't blank them, but a restart wiped that - a deploy landing during a lockout left the tyre and latest-session tiles empty until it lifted. - cache: getDurable/setDurable keep never-changing data in memory and, when CACHE_DIR is set, mirror it to disk as small JSON files (atomic write, ignored after 30 days). tyre_usage and latest_session use it for finished sessions; anything else immutable can too. - image: /data owned by the non-root user, CACHE_DIR=/data by default - mount a volume there to persist; without one it still works, it just doesn't outlive the container. - startup probes the directory and logs a warning if it isn't writable, instead of silently not persisting. - README, docker-compose example. Verified in the real scratch image: fresh named volume and no volume both start clean; a read-only mount logs the warning.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenF1's free tier returns
401 Live F1 session in progressfor everything (past sessions included) for a stretch around every live session - observed starting ~15 min before a session and lifting ~30 min after. Finished sessions were already kept in memory so a lockout couldn't blank them, but a restart wiped that: a deploy landing inside a lockout left the Tyre Usage and Latest Session tiles empty until it lifted.cache.getDurable/setDurablekeep never-changing data in memory and, whenCACHE_DIRis set, mirror it to disk as small JSON files (atomic temp-file + rename; ignored after 30 days).tyre_usageandlatest_sessionuse it for finished sessions; anything else immutable can too./dataowned by the non-root user (65532) andCACHE_DIR=/databy default. Mount a volume there to persist; without one it still works, it just doesn't outlive the container.Test plan
gofmt/go vet/go test ./...clean; new test: a "restarted" instance (empty memory, same dir, upstream locked out) still serves tyre and latest-session data, while one without a dir showsupstream_errorCluster side (PVC + mount): see the companion PR in drumandbytes/cluster.