fixed connection reconnection logic

This commit is contained in:
2026-02-08 00:54:31 +08:00
parent 4ad6fb709c
commit f0cb2fd1d0
7 changed files with 141 additions and 28 deletions

View File

@@ -9,6 +9,7 @@ use crate::{
services::{
close_all_windows,
health_manager::open_health_manager_window,
health_monitor::{start_health_monitor, stop_health_monitor},
scene::open_scene_window,
ws::client::{clear_ws_client, establish_websocket_connection},
},
@@ -39,13 +40,15 @@ async fn connect_user_profile() {
init_app_data_scoped(AppDataRefreshScope::All).await;
establish_websocket_connection().await;
start_background_token_refresh().await;
start_health_monitor().await;
}
/// Clears the user profile and WebSocket connection.
async fn disconnect_user_profile() {
stop_health_monitor();
stop_background_token_refresh();
clear_app_data();
clear_ws_client().await;
stop_background_token_refresh();
}
/// Destructs the user session and show health manager window