2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 03:11:24 +00:00

Background deletions

This commit is contained in:
asonix 2020-06-06 19:33:29 -05:00
parent d60862a0d0
commit fcf18ceca5

View file

@ -1,7 +1,7 @@
use crate::{error::UploadError, safe_save_file, to_ext, ACCEPTED_MIMES};
use actix_web::web;
use futures::stream::{Stream, StreamExt};
use log::warn;
use log::{error, warn};
use sha2::Digest;
use std::{path::PathBuf, pin::Pin, sync::Arc};
@ -127,7 +127,14 @@ impl UploadManager {
let image_dir = self.image_dir();
web::block(move || blocking_delete_all_by_filename(image_dir, &real_filename)).await?;
// -- DELETE FILES --
actix_rt::spawn(async move {
if let Err(e) =
web::block(move || blocking_delete_all_by_filename(image_dir, &real_filename)).await
{
error!("Error removing files from fs, {}", e);
}
});
Ok(())
}