Use asynchronous file removal in backup process

This commit is contained in:
Greg Burri 2025-04-30 01:51:09 +02:00
parent 8152d3d9b0
commit 104ae6b38e

View file

@ -64,7 +64,7 @@ async fn start(db_connection: &db::Connection, path: &PathBuf) {
Ok(mut file_output) => {
if let Err(error) = tokio::io::copy(&mut encoder, &mut file_output).await {
error!("Error when compressing backup file: {}", error);
} else if let Err(error) = std::fs::remove_file(path) {
} else if let Err(error) = tokio::fs::remove_file(path).await {
error!("Error when removing uncompressed backup file: {}", error);
} else {
info!("Backup done: {}", path_compressed.display());