Keep application/octet-stream out of memory for variants (closes #70)
check / check (push) Successful in 3m30s

VariantStorage.LoadWithMeta now returns an empty content type when the
.meta file is missing or unreadable, and GetVariant serves
application/octet-stream in that case without keeping it in memory.
Memory now only ever holds a content type read from a .meta file or
passed to StoreVariant, so a read that ran before a store wrote the
.meta file can no longer leave the wrong type in memory, however it
interleaves with the store, other reads and eviction.

Model: opus-5-5
This commit is contained in:
2026-09-29 08:28:26 +00:00
parent 8620a46c90
commit de6f5e34ea
4 changed files with 25 additions and 15 deletions
+7 -6
View File
@@ -34,12 +34,13 @@ exhaustion
`Cache.metaCache` holds the content types of up to 10,000 variants in an LRU
(`github.com/hashicorp/golang-lru/v2`), filled by `StoreVariant` and by
`GetVariant` after it reads a `.meta` file, where a type `StoreVariant` added
meanwhile is kept over the one read; for a variant it holds, `GetVariant`
skips the `.meta` read, still opening the variant file and taking the size
from it; eviction removes the entry before deleting the files, and
`GetVariant` removes it when the file will not open; the cap is a constant,
not a setting; the unused `variantMeta` type is gone; `README.md` describes
it.
meanwhile is kept over the one read, and never with the
`application/octet-stream` served for a variant without one; for a variant it
holds, `GetVariant` skips the `.meta` read, still opening the variant file and
taking the size from it; eviction removes the entry before deleting the files,
and `GetVariant` removes it when the file will not open; the cap is a
constant, not a setting; the unused `variantMeta` type is gone; `README.md`
describes it.
- 2026-09-29 Dockerfiles install through `script/bootstrap` (closes #95): the
`Dockerfile` lint and build stages and `Dockerfile.lint` copy `script/`,
`go.mod` and `go.sum`, then run `script/bootstrap` in place of their own