Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: set PRAGMA synchronous=normal #2382

Merged
merged 1 commit into from
Apr 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,12 @@ impl Sql {
*self.pool.write().await = Some(Self::new_pool(dbfile.as_ref(), readonly)?);

if !readonly {
// journal_mode is persisted, it is sufficient to change it only for one handle.
self.with_conn(move |conn| {
// journal_mode is persisted, it is sufficient to change it only for one handle.
conn.pragma_update(None, "journal_mode", &"WAL".to_string())?;

// Default synchronous=FULL is much slower. NORMAL is sufficient for WAL mode.
conn.pragma_update(None, "synchronous", &"NORMAL".to_string())?;
Ok(())
})
.await?;
Expand Down