turn off synchronous mode during fs resyncs

feat/vaults
Tomáš Mládek 2021-12-04 21:43:13 +01:00
parent 99c4a4e488
commit 4b1a8c862c
1 changed files with 6 additions and 0 deletions

View File

@ -97,6 +97,9 @@ fn _rescan_vault<T: AsRef<Path>>(
// Initialize types, etc...
initialize_types(&pool)?;
// Disable syncing in SQLite for the duration of the import
pool.get()?.execute("PRAGMA synchronous = OFF;")?;
// Walk through the vault, find all paths
let path_entries: Vec<PathBuf> = WalkDir::new(&directory)
.follow_links(true)
@ -178,6 +181,9 @@ fn _rescan_vault<T: AsRef<Path>>(
)
}
// Re-enable SQLite syncing
pool.get()?.execute("PRAGMA synchronous = NORMAL;")?;
info!(
"Finished updating {} ({} created, {} deleted, {} left unchanged). Took {}s.",
directory.as_ref().display(),