Skip to main content

Mountain/IPC/StatusReporter/
mountain_perform_health_check.rs

1//! `mountain_perform_health_check` Tauri command - runs a
2//! synchronous health-check pass and returns the resulting
3//! `HealthMonitor::Struct`.
4
5use tauri::Manager;
6
7use crate::{
8	IPC::StatusReporter::{HealthMonitor::Struct as HealthMonitor, Reporter::Struct as Reporter},
9	dev_log,
10};
11
12#[tauri::command]
13pub async fn mountain_perform_health_check(app_handle:tauri::AppHandle) -> Result<HealthMonitor, String> {
14	dev_log!("lifecycle", "Tauri command: perform_health_check");
15
16	if let Some(reporter) = app_handle.try_state::<Reporter>() {
17		reporter.perform_health_check().await?;
18
19		reporter.get_health_status()
20	} else {
21		Err("StatusReporter not found in application state".to_string())
22	}
23}