fix: 等待 task 执行 (#238)
This commit is contained in:
@@ -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)> {
|
||||||
|
|||||||
Reference in New Issue
Block a user