mirror of
https://github.com/atuinsh/atuin.git
synced 2025-01-01 03:51:12 +01:00
fix: set durability for sqlite to recommended settings (#1667)
Also do an optimize on connection close. Fixes lag on history insertion.
This commit is contained in:
parent
c2af6f7ae8
commit
b7bb583d8d
@ -14,7 +14,10 @@ use rand::{distributions::Alphanumeric, Rng};
|
|||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use sql_builder::{esc, quote, SqlBuilder, SqlName};
|
use sql_builder::{esc, quote, SqlBuilder, SqlName};
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePool, SqlitePoolOptions, SqliteRow},
|
sqlite::{
|
||||||
|
SqliteConnectOptions, SqliteJournalMode, SqlitePool, SqlitePoolOptions, SqliteRow,
|
||||||
|
SqliteSynchronous,
|
||||||
|
},
|
||||||
Result, Row,
|
Result, Row,
|
||||||
};
|
};
|
||||||
use time::OffsetDateTime;
|
use time::OffsetDateTime;
|
||||||
@ -137,6 +140,8 @@ impl Sqlite {
|
|||||||
|
|
||||||
let opts = SqliteConnectOptions::from_str(path.as_os_str().to_str().unwrap())?
|
let opts = SqliteConnectOptions::from_str(path.as_os_str().to_str().unwrap())?
|
||||||
.journal_mode(SqliteJournalMode::Wal)
|
.journal_mode(SqliteJournalMode::Wal)
|
||||||
|
.optimize_on_close(true, None)
|
||||||
|
.synchronous(SqliteSynchronous::Normal)
|
||||||
.create_if_missing(true);
|
.create_if_missing(true);
|
||||||
|
|
||||||
let pool = SqlitePoolOptions::new()
|
let pool = SqlitePoolOptions::new()
|
||||||
|
Loading…
Reference in New Issue
Block a user