Skip to main content

Mountain/IPC/StatusReporter/
mountain_perform_health_check.rs

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