Expire stored source photos after 7 days, keeping grades forever

Storing originals for Regrade grew the database ~16MB per grade at the
upload cap. Photos now expire on a configurable window (default 7 days,
counted from last grade so regrading resets it) and the file is VACUUMed so
the space is actually returned — clearing the column alone only moves pages
to the freelist, which would have made the whole feature a no-op on disk.
Grades, thumbnails and measurements are never pruned; a pruned card's
Regrade falls back to the existing re-pick path, now with a banner saying
why.
This commit is contained in:
Barely Removable 2026-08-22 13:07:09 -07:00
parent 633cb98462
commit 602bce8ce3
5 changed files with 127 additions and 0 deletions

View file

@ -35,3 +35,10 @@ services:
# This app is reverse-proxied at hippofam.com/cards, not the domain
# root — see app.py's BASE_PATH handling.
- CARD_GRADER_BASE_PATH=/cards
# How long a grade keeps the original photo(s) that produced it, so
# Regrade can re-run without asking for them again. Grades, their
# thumbnails and every measurement are kept FOREVER regardless — only
# the photos expire, since they're what makes the database grow (up
# to ~16MB per grade at the upload cap). Past the window, Regrade
# falls back to asking for the photo. 0 disables pruning.
- CARD_GRADER_IMAGE_RETENTION_DAYS=7