fix: defer setup resources until after first window

This commit is contained in:
Tunglies
2026-06-30 12:53:21 +08:00
parent 4aec41d3be
commit a862667d9b
2 changed files with 5 additions and 6 deletions
+1 -5
View File
@@ -123,7 +123,7 @@ pub async fn delete_log() -> Result<()> {
}
/// 初始化DNS配置文件
async fn init_dns_config() -> Result<()> {
pub(super) async fn init_dns_config() -> Result<()> {
use serde_yaml_ng::Value;
// 创建DNS子配置
@@ -307,10 +307,6 @@ pub async fn init_config() -> Result<()> {
logging!(info, Type::Setup, "后台日志清理任务完成");
});
if let Err(e) = init_dns_config().await {
logging!(warn, Type::Setup, "DNS config initialization failed: {}", e);
}
Ok(())
}
+4 -1
View File
@@ -31,7 +31,6 @@ static RESOLVE_DONE: AtomicBool = AtomicBool::new(false);
pub fn init_work_dir_and_logger() -> anyhow::Result<()> {
AsyncHandler::block_on(async {
init_work_config().await;
init_resources().await;
logging!(info, Type::Setup, "Initializing logger");
// #[cfg(not(feature = "tokio-trace"))]
Logger::global().init().await?;
@@ -55,6 +54,10 @@ pub fn resolve_setup_async() {
init_startup_script().await;
let config_initialized = init_verge_config_before_window().await;
init_window().await;
init_resources().await;
if let Err(e) = init::init_dns_config().await {
logging!(warn, Type::Setup, "DNS config initialization failed: {}", e);
}
if config_initialized {
init_verge_config().await;
}