diff --git a/src/main.rs b/src/main.rs index 7a2d0b9..93df054 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1945,6 +1945,24 @@ fn watch_files( let mut last_full_scan = SystemTime::now(); let mut scan_count = 0u64; + // Initial availability sweep before the loop's first sleep so + // /libraries reports the truth from the very first request, + // rather than the optimistic Online default that + // new_health_map seeds. Without this, an unmounted share would + // appear online for up to WATCH_QUICK_INTERVAL_SECONDS (default + // 60s) after boot. Same probe logic as the per-tick gate + // below; no ingest runs here, just the health update + log. + for lib in &libs { + let context = opentelemetry::Context::new(); + let had_data = exif_dao + .lock() + .expect("exif_dao poisoned") + .count_for_library(&context, lib.id) + .map(|n| n > 0) + .unwrap_or(false); + libraries::refresh_health(&library_health, lib, had_data); + } + loop { std::thread::sleep(Duration::from_secs(quick_interval_secs));