refactor: use async instead of block_on

This commit is contained in:
MystiPanda
2024-06-29 19:02:37 +08:00
parent c1a201f358
commit 1293d25e1b
11 changed files with 81 additions and 74 deletions

View File

@@ -46,8 +46,8 @@ impl Config {
}
/// 初始化订阅
pub fn init_config() -> Result<()> {
crate::log_err!(Self::generate());
pub async fn init_config() -> Result<()> {
crate::log_err!(Self::generate().await);
if let Err(err) = Self::generate_file(ConfigType::Run) {
log::error!(target: "app", "{err}");
@@ -83,8 +83,8 @@ impl Config {
}
/// 生成订阅存好
pub fn generate() -> Result<()> {
let (config, exists_keys, logs) = enhance::enhance();
pub async fn generate() -> Result<()> {
let (config, exists_keys, logs) = enhance::enhance().await;
*Config::runtime().draft() = IRuntime {
config: Some(config),