refactor: 整理重构下载任务调度部分的代码,增强可读性和鲁棒性 (#531)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-11-11 01:29:52 +08:00
committed by GitHub
parent 8931cb5d2a
commit 670f21a725
6 changed files with 250 additions and 192 deletions

View File

@@ -18,12 +18,9 @@ pub trait NotifierAllExt {
async fn notify_all(&self, client: &reqwest::Client, message: &str) -> Result<()>;
}
impl NotifierAllExt for Option<Vec<Notifier>> {
impl NotifierAllExt for Vec<Notifier> {
async fn notify_all(&self, client: &reqwest::Client, message: &str) -> Result<()> {
let Some(notifiers) = self else {
return Ok(());
};
future::join_all(notifiers.iter().map(|notifier| notifier.notify(client, message))).await;
future::join_all(self.iter().map(|notifier| notifier.notify(client, message))).await;
Ok(())
}
}