Skip to content

Commit

Permalink
避免在qbittorrent离线时失败导致qbit插件崩溃
Browse files Browse the repository at this point in the history
  • Loading branch information
Chikage0o0 committed Oct 30, 2023
1 parent 5c548da commit 9217d21
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/qbittorrent/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ pub async fn run(client: Client, plugin_folder: impl AsRef<std::path::Path>) ->
}

loop {
let (expire, upload) = qbit::ops::scan_torrent(API.get().unwrap()).await?;
let (expire, upload) = qbit::ops::scan_torrent(API.get().unwrap()).await.unwrap_or_else(
|e| {
log::error!("scan torrent failed: {}", e);
(HashMap::new(), HashMap::new())
}
);


expire_torrents(API.get().unwrap(), &expire)
.await
Expand Down

0 comments on commit 9217d21

Please sign in to comment.