We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 982f5f1 commit 1aec584Copy full SHA for 1aec584
1 file changed
crates/sqlx-sqlite-conn-mgr/src/database.rs
@@ -242,6 +242,11 @@ impl SqliteDatabase {
242
.execute(&mut *conn)
243
.await?;
244
245
+ // https://www.sqlite.org/wal.html#performance_considerations
246
+ sqlx::query("PRAGMA synchronous = NORMAL")
247
+ .execute(&mut *conn)
248
+ .await?;
249
+
250
self.wal_initialized.store(true, Ordering::SeqCst);
251
}
252
@@ -563,6 +568,17 @@ mod tests {
563
568
"Journal mode should be WAL after first acquire_writer"
564
569
);
565
570
571
+ // Check sync setting
572
+ let (sync,): (i32,) = sqlx::query_as("PRAGMA synchronous")
573
+ .fetch_one(&mut *writer)
574
+ .await
575
+ .unwrap();
576
577
+ assert_eq!(
578
+ sync, 1,
579
+ "Sync mode should be NORMAL after first acquire_writer"
580
+ );
581
566
582
drop(writer);
567
583
584
db.remove().await.unwrap();
0 commit comments