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:
parent
633cb98462
commit
602bce8ce3
5 changed files with 127 additions and 0 deletions
27
README.md
27
README.md
|
|
@ -72,6 +72,33 @@ All your data lives in `grades.db` in this folder — your settings and your
|
|||
entire grading history, thumbnails included. Back up that one file and
|
||||
you've backed up everything.
|
||||
|
||||
### What's kept, and for how long
|
||||
|
||||
Grades are kept **forever**: the estimate, every category finding, the
|
||||
measurements, and the thumbnail. Nothing expires there.
|
||||
|
||||
The **original photos** are a different matter. Each grade stores the
|
||||
photo(s) that produced it so **Regrade** can re-run without asking for them
|
||||
again — which is worth most right after a grading-logic change, and worth
|
||||
progressively less as time passes. They're also what makes the database
|
||||
grow: up to ~16MB per grade at the upload cap, so a few hundred grades
|
||||
would otherwise run into gigabytes.
|
||||
|
||||
So stored photos expire after **7 days**, and the database is compacted to
|
||||
actually give the space back. Past that window a card's Regrade button asks
|
||||
you to pick the photo again instead of re-running instantly — and once you
|
||||
do, that card starts the clock over.
|
||||
|
||||
Change the window with `CARD_GRADER_IMAGE_RETENTION_DAYS` (set it to `0` to
|
||||
keep photos forever, if disk isn't a concern):
|
||||
|
||||
```bash
|
||||
CARD_GRADER_IMAGE_RETENTION_DAYS=30 python3 app.py
|
||||
```
|
||||
|
||||
The countdown runs from when a card was last graded, not when it was first
|
||||
graded — so regrading a card keeps its photos for another full window.
|
||||
|
||||
### Optional packages
|
||||
|
||||
Two packages unlock real functionality. Each is checked for at runtime, so
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue