Keep application/octet-stream out of memory for variants (closes #70)
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:
@@ -33,12 +33,13 @@ P2: security: referer blacklist
|
||||
`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 maintenance mode refuses image requests (closes #71): while
|
||||
`maintenance_mode` is on, `/v1/image/` and `/v1/e/` answer 503 with a
|
||||
`Retry-After` header and the JSON error body, from one middleware in
|
||||
|
||||
Reference in New Issue
Block a user