logging
This commit is contained in:
parent
a6e92c0b4e
commit
c8b8a76bba
2 changed files with 10 additions and 10 deletions
|
@ -219,8 +219,8 @@ pub fn fetch_or_create_dir<C: Connection<Backend = Sqlite>>(
|
|||
}
|
||||
}
|
||||
1 => Ok(valid_directories[0].clone()),
|
||||
_ => Err(anyhow!(
|
||||
"Invalid database state - more than one directory matches the query!"
|
||||
_ => Err(anyhow!(format!(
|
||||
"Invalid database state - more than one directory matches the query {:?}/{:#}!", parent, directory)
|
||||
)),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,18 +93,18 @@ fn _rescan_vault<T: AsRef<Path>>(
|
|||
job_id: JobId,
|
||||
) -> Result<Vec<UpdatePathResult>> {
|
||||
let start = Instant::now();
|
||||
info!("[rescan] Vault rescan started.");
|
||||
info!("Vault rescan started.");
|
||||
|
||||
// Initialize types, etc...
|
||||
debug!("[rescan] Initializing DB types.");
|
||||
debug!("Initializing DB types.");
|
||||
initialize_types(&pool)?;
|
||||
|
||||
// Disable syncing in SQLite for the duration of the import
|
||||
debug!("[rescan] Disabling SQLite synchronous mode");
|
||||
debug!("Disabling SQLite synchronous mode");
|
||||
pool.get()?.execute("PRAGMA synchronous = OFF;")?;
|
||||
|
||||
// Walk through the vault, find all paths
|
||||
debug!("[rescan] Traversing vault directory");
|
||||
debug!("Traversing vault directory");
|
||||
let path_entries: Vec<PathBuf> = WalkDir::new(&directory)
|
||||
.follow_links(true)
|
||||
.into_iter()
|
||||
|
@ -187,7 +187,7 @@ fn _rescan_vault<T: AsRef<Path>>(
|
|||
}
|
||||
|
||||
// Re-enable SQLite syncing
|
||||
debug!("[rescan] Re-enabling synchronous mode.");
|
||||
debug!("Re-enabling synchronous mode.");
|
||||
pool.get()?.execute("PRAGMA synchronous = NORMAL;")?;
|
||||
|
||||
info!(
|
||||
|
@ -209,7 +209,7 @@ fn _process_directory_entry<P: AsRef<Path>>(
|
|||
directory_path: &P,
|
||||
existing_files: &Arc<RwLock<Vec<models::File>>>,
|
||||
) -> UpdatePathResult {
|
||||
debug!("[rescan] Processing: {:?}", path);
|
||||
debug!("Processing: {:?}", path);
|
||||
|
||||
// Prepare the data
|
||||
let connection = &db_pool.write().unwrap().get()?;
|
||||
|
@ -264,7 +264,7 @@ fn _process_directory_entry<P: AsRef<Path>>(
|
|||
|
||||
if let Some(idx) = maybe_existing_file {
|
||||
existing_files_write.swap_remove(idx);
|
||||
debug!("[rescan] Unchanged: {:?}", path);
|
||||
debug!("Unchanged: {:?}", path);
|
||||
return Ok(UpdatePathOutcome::Unchanged(path));
|
||||
}
|
||||
}
|
||||
|
@ -343,7 +343,7 @@ fn _process_directory_entry<P: AsRef<Path>>(
|
|||
};
|
||||
insert_entry(connection, name_entry)?;
|
||||
|
||||
info!("[rescan] Added: {:?}", path);
|
||||
info!("Added: {:?}", path);
|
||||
Ok(UpdatePathOutcome::Added(path.clone()))
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue