Reels pre-gen: use DEFAULT_MAX_SEGMENTS so cache keys match on-demand

pregen_one hardcoded max_segments: 24 while create_reel_handler defaults
to DEFAULT_MAX_SEGMENTS (40). Since the cache key encodes the raw
max_segments, the pre-generated reel's key never matched the client's
on-demand request, so POST /reels cache-hit an older max=40 reel and the
agentic pre-gen file was left orphaned. Align to DEFAULT_MAX_SEGMENTS (as
the plan specified) so the on-demand cache-hit path serves the pre-gen
reel. Content is unchanged — the actual beat count is duration-budgeted
either way; only the key descriptor differed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cameron Cordes
2026-06-13 23:12:54 -04:00
parent ca007a618d
commit 19fc1bbdf8
+5 -1
View File
@@ -1053,7 +1053,11 @@ async fn pregen_one(
} else { } else {
Some(library.to_string()) Some(library.to_string())
}, },
max_segments: 24, // Must match the on-demand default (create_reel_handler) so the cache
// key — which encodes the raw max_segments — lines up and the on-demand
// cache-hit path serves this pre-generated reel. The client sends no
// max_segments, so it defaults to DEFAULT_MAX_SEGMENTS there too.
max_segments: selector::DEFAULT_MAX_SEGMENTS,
}; };
let exif_dao = app_state.insight_generator.exif_dao(); let exif_dao = app_state.insight_generator.exif_dao();