mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
fix: enhance startup speed and fix connection issues during initialization
This commit is contained in:
@@ -16,11 +16,16 @@ pub mod ui;
|
||||
pub mod window;
|
||||
pub mod window_script;
|
||||
|
||||
pub fn resolve_setup_sync(app_handle: AppHandle) {
|
||||
pub fn resolve_setup_handle(app_handle: AppHandle) {
|
||||
init_handle(app_handle);
|
||||
init_scheme();
|
||||
init_embed_server();
|
||||
NetworkManager::new().init();
|
||||
}
|
||||
|
||||
pub fn resolve_setup_sync() {
|
||||
AsyncHandler::spawn(|| async {
|
||||
AsyncHandler::spawn_blocking(|| init_scheme());
|
||||
AsyncHandler::spawn_blocking(|| init_embed_server());
|
||||
AsyncHandler::spawn_blocking(|| NetworkManager::new().init());
|
||||
});
|
||||
}
|
||||
|
||||
pub fn resolve_setup_async() {
|
||||
@@ -33,28 +38,30 @@ pub fn resolve_setup_async() {
|
||||
std::thread::current().id()
|
||||
);
|
||||
|
||||
// AsyncHandler::spawn_blocking(|| AsyncHandler::block_on(init_work_config()));
|
||||
|
||||
AsyncHandler::spawn(|| async {
|
||||
init_work_config().await;
|
||||
init_resources().await;
|
||||
init_startup_script().await;
|
||||
futures::join!(
|
||||
init_work_config(),
|
||||
init_resources(),
|
||||
init_startup_script(),
|
||||
init_hotkey(),
|
||||
);
|
||||
|
||||
init_timer().await;
|
||||
init_hotkey().await;
|
||||
init_auto_lightweight_mode().await;
|
||||
|
||||
init_verge_config().await;
|
||||
init_core_manager().await;
|
||||
init_system_proxy().await;
|
||||
|
||||
init_system_proxy().await;
|
||||
AsyncHandler::spawn_blocking(|| {
|
||||
init_system_proxy_guard();
|
||||
});
|
||||
|
||||
init_window().await;
|
||||
init_tray().await;
|
||||
refresh_tray_menu().await
|
||||
let tray_and_refresh = async {
|
||||
init_tray().await;
|
||||
refresh_tray_menu().await;
|
||||
};
|
||||
futures::join!(init_window(), tray_and_refresh,);
|
||||
});
|
||||
|
||||
let elapsed = start_time.elapsed();
|
||||
|
||||
Reference in New Issue
Block a user