fix: actually remove objects on rescan

feat/type-attributes
Tomáš Mládek 2022-10-01 22:16:59 +02:00
parent 5a6390e8f3
commit 3b4378dfed
2 changed files with 13 additions and 3 deletions

View File

@ -49,3 +49,9 @@ pub struct NewFile {
pub size: i64,
pub mtime: Option<NaiveDateTime>,
}
impl From<File> for crate::addressing::Address {
fn from(file: File) -> Self {
crate::addressing::Address::Hash(file.hash)
}
}

View File

@ -18,7 +18,7 @@ use chrono::prelude::*;
use diesel::r2d2::{self, ConnectionManager};
use diesel::ExpressionMethods;
use diesel::{Connection, QueryDsl, RunQueryDsl, SqliteConnection};
use log::{debug, error, info, warn, trace};
use log::{debug, error, info, trace, warn};
use lru::LruCache;
use rayon::prelude::*;
use serde_json::json;
@ -216,7 +216,7 @@ impl FsStore {
let cleanup_results = existing_files.iter().filter(|f| f.valid).map(|file| {
let trans_result = upconnection.transaction::<_, Error, _>(|| {
self.file_set_valid(file.id, false)?;
// remove_object(&connection, )?
upconnection.remove_object(Address::from(file.clone()))?;
Ok(())
});
@ -682,7 +682,11 @@ impl UpStore for FsStore {
mut job_container: JobContainer,
initial: bool,
) -> Result<Vec<UpdatePathOutcome>, StoreError> {
trace!("Running a vault update of {:?}, initial = {}.", self.path, initial);
trace!(
"Running a vault update of {:?}, initial = {}.",
self.path,
initial
);
let job_result = job_container.add_job("REIMPORT", "Scaning vault directory...");
match job_result {