Skip to main content

Mountain/IPC/StatusReporter/
mountain_perform_health_check.rs

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