refactor: compile the crate once — main.rs uses the library
main.rs re-declared nearly every module (`mod ai; mod database; …`) that lib.rs also declared, so the ~100k-line crate compiled twice in every build (lib for the src/bin tools, bin for the server) and the test suite ran most tests twice. watcher.rs even reached into the lib copy via `image_api::` from inside the bin copy. The six bin-only modules (backfill, handlers, hls_stats, knowledge, reels, watcher) move into lib.rs; main.rs keeps only startup wiring over `use image_api::…`. A few items main calls become `pub`, and the dead_code allowances that only existed because each copy saw half the callers are gone. CLAUDE.md says not to reintroduce `mod` in main.rs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4f35f87ea3
commit
640cd3833a
9 files changed
+27
-82
No files matched your search
+2
-2
@@ -1045,7 +1045,7 @@ fn load_pregen_params(app_state: &AppState) -> (String, Option<String>, String)
|
||||
}
|
||||
|
||||
/// Spawn the nightly pre-generation scheduler. Runs behind `REEL_PREGEN_ENABLED`.
|
||||
pub(crate) async fn spawn_pregen_scheduler(app_state: web::Data<AppState>) {
|
||||
pub async fn spawn_pregen_scheduler(app_state: web::Data<AppState>) {
|
||||
if std::env::var("REEL_PREGEN_ENABLED").ok() != Some("1".to_string()) {
|
||||
log::info!("Reel pre-generation scheduler disabled (REEL_PREGEN_ENABLED != 1)");
|
||||
return;
|
||||
@@ -1270,7 +1270,7 @@ fn reel_cache_max_age_secs() -> u64 {
|
||||
/// Spawn the periodic on-disk reel-cache sweeper. Runs independently of the
|
||||
/// pre-gen scheduler because the on-demand cache grows whether or not pre-gen
|
||||
/// is enabled. Disable with `REEL_CACHE_SWEEP_ENABLED=0`.
|
||||
pub(crate) async fn spawn_reel_cache_sweeper(app_state: web::Data<AppState>) {
|
||||
pub async fn spawn_reel_cache_sweeper(app_state: web::Data<AppState>) {
|
||||
if std::env::var("REEL_CACHE_SWEEP_ENABLED").ok().as_deref() == Some("0") {
|
||||
log::info!("Reel cache sweeper disabled (REEL_CACHE_SWEEP_ENABLED=0)");
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user