fix: 等待 task 执行 (#238)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-02-01 20:13:58 +08:00
committed by GitHub
parent 51672e8607
commit 2c4fa441e7

View File

@@ -31,7 +31,7 @@ async fn main() {
let mut anchor = chrono::Local::now().date_naive(); let mut anchor = chrono::Local::now().date_naive();
let bili_client = BiliClient::new(); let bili_client = BiliClient::new();
let params = build_params(); let params = build_params();
tokio::spawn(async move { let task = tokio::spawn(async move {
loop { loop {
'inner: { 'inner: {
match bili_client.wbi_img().await.map(|wbi_img| wbi_img.into()) { match bili_client.wbi_img().await.map(|wbi_img| wbi_img.into()) {
@@ -62,6 +62,7 @@ async fn main() {
time::sleep(time::Duration::from_secs(CONFIG.interval)).await; time::sleep(time::Duration::from_secs(CONFIG.interval)).await;
} }
}); });
task.await.expect("程序异常退出");
} }
fn build_params() -> Vec<(Args<'static>, &'static PathBuf)> { fn build_params() -> Vec<(Args<'static>, &'static PathBuf)> {