From 2c4fa441e7a35fafc4ee1b95e7723902e2b20716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=80=E1=B4=8D=E1=B4=9B=E1=B4=8F=E1=B4=80=E1=B4=87?= =?UTF-8?q?=CA=80?= Date: Sat, 1 Feb 2025 20:13:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AD=89=E5=BE=85=20task=20=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=20(#238)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/bili_sync/src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/bili_sync/src/main.rs b/crates/bili_sync/src/main.rs index 416cd0e..e71e5fb 100644 --- a/crates/bili_sync/src/main.rs +++ b/crates/bili_sync/src/main.rs @@ -31,7 +31,7 @@ async fn main() { let mut anchor = chrono::Local::now().date_naive(); let bili_client = BiliClient::new(); let params = build_params(); - tokio::spawn(async move { + let task = tokio::spawn(async move { loop { 'inner: { 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; } }); + task.await.expect("程序异常退出"); } fn build_params() -> Vec<(Args<'static>, &'static PathBuf)> {