Whole-timeline downloads are cached per revision (#204)
- github
- github/openchronology/timeline-app
- commit
- main
- github/athanclark
The .ochx and .och files the server makes for a timeline's revision are kept and sent again to the next download of that revision, on disk or in an S3-compatible bucket (server/export-cache.mjs, oc_export_cache), within EXPORT_CACHE_MAX_BYTES by evicting the least recently downloaded. The first download streams as before while it is written beside; only a complete file of the revision asked for is kept, one build per key claimed across servers. Access is checked on every download. Cached files carry an ETag and serve byte ranges; public timelines' files redirect to EXPORT_CACHE_PUBLIC_URL (a file server or CDN) once cached, and are swept away if they stop being public. Deleted timelines' files go with them. The Debian and RPM service gets a CacheDirectory, so the cache is on there by default (2 GiB); elsewhere it is on when EXPORT_CACHE_DIR is set. S3 requests are signed with Signature Version 4 in node:crypto (no new dependency). At 100,000 moments an .ochx download takes 1.4 s without the cache and 0.26 s from it (bench/export-cache.mjs). streamResponse no longer piles up close listeners on long downloads. Closes #204 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/commit/638991645dda6d5142e05e948d8ff6283c208cdf
Related
Open Whole-timeline downloads are cached per revision (#204) in the timeline