Skip to main content

Mountain/IPC/StatusReporter/
mountain_start_service_discovery.rs

1//! `mountain_start_service_discovery` Tauri command - kicks
2//! off the periodic service-discovery background task driven
3//! by `ServiceRegistry::Struct::discovery_interval`.
4
5use tauri::Manager;
6
7use crate::{IPC::StatusReporter::Reporter::Struct as Reporter, dev_log};
8
9#[tauri::command]
10pub async fn mountain_start_service_discovery(app_handle:tauri::AppHandle) -> Result<(), String> {
11	dev_log!("lifecycle", "Tauri command: start_service_discovery");
12
13	if let Some(reporter) = app_handle.try_state::<Reporter>() {
14		reporter.start_periodic_discovery().await
15	} else {
16		Err("StatusReporter not found in application state".to_string())
17	}
18}