mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-10-14 21:20:48 +08:00
fix: defer setup resources until after first window
This commit is contained in:
@@ -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(())
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user