Reels: bound disk/ledger growth (pre-gen prune + on-demand cache sweep)
Nothing reaped reels before, so the on-disk cache and ledger grew unbounded — each night's daily reel is a new ~4MB file + ledger row that's stale within ~26h. - Pre-gen self-prune: after recording a reel, prune_superseded keeps the newest PREGEN_KEEP_PER_SCOPE (2) rows per (span, library) and unlinks the superseded reels' mp4+sidecar. Caps the ledger/disk at ~spans×libraries×2. - On-disk sweeper (spawn_reel_cache_sweeper): every 24h, removes reel mp4s with no ledger row and no live job older than REEL_CACHE_MAX_AGE_DAYS (7) — bounding the on-demand cache, which has no ledger row and otherwise grows forever — plus crashed-render cruft (.mp4.tmp/.concat.txt/orphan sidecars). Runs regardless of REEL_PREGEN_ENABLED; disable with REEL_CACHE_SWEEP_ENABLED=0. - New DAO methods prune_superseded + all_cache_keys (with tests); env knobs documented in .env.example. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
664b3694f8
commit
7e21213181
4 files changed
+296
-17
No files matched your search
@@ -269,6 +269,8 @@ fn main() -> std::io::Result<()> {
|
||||
|
||||
// Spawn the nightly pre-generation scheduler (Section D).
|
||||
reels::spawn_pregen_scheduler(app_state.clone()).await;
|
||||
// Spawn the on-disk reel-cache sweeper (bounds pre-gen + on-demand reels).
|
||||
reels::spawn_reel_cache_sweeper(app_state.clone()).await;
|
||||
|
||||
HttpServer::new(move || {
|
||||
let user_dao = SqliteUserDao::new();
|
||||
|
||||
Reference in new issue
Block a user