change clear_output_folder position to prevent extra write operations

This commit is contained in:
yggverse 2025-08-02 15:51:17 +03:00
parent 722f472e46
commit 9a64995bf5

View file

@ -247,6 +247,10 @@ async fn main() -> Result<()> {
.delete(librqbit::api::TorrentIdOrHash::Id(id), false) .delete(librqbit::api::TorrentIdOrHash::Id(id), false)
.await?; .await?;
// cleanup `output_folder` only if the torrent is resolved
// to prevent extra write operations on the next iteration
preload.clear_output_folder(&i)?;
if config.debug { if config.debug {
println!("\t\t\tadd `{i}` to index.") println!("\t\t\tadd `{i}` to index.")
} }
@ -260,7 +264,6 @@ async fn main() -> Result<()> {
} }
} }
} }
preload.clear_output_folder(&i)?;
} }
} }
if config.debug { if config.debug {