turn off WAL (#5203)
This commit is contained in:
@@ -353,8 +353,7 @@ impl SessionStorage {
|
|||||||
let options = SqliteConnectOptions::new()
|
let options = SqliteConnectOptions::new()
|
||||||
.filename(db_path)
|
.filename(db_path)
|
||||||
.create_if_missing(create_if_missing)
|
.create_if_missing(create_if_missing)
|
||||||
.busy_timeout(std::time::Duration::from_secs(5))
|
.busy_timeout(std::time::Duration::from_secs(5));
|
||||||
.journal_mode(sqlx::sqlite::SqliteJournalMode::Wal);
|
|
||||||
|
|
||||||
sqlx::SqlitePool::connect_with(options).await.map_err(|e| {
|
sqlx::SqlitePool::connect_with(options).await.map_err(|e| {
|
||||||
anyhow::anyhow!(
|
anyhow::anyhow!(
|
||||||
@@ -630,7 +629,7 @@ impl SessionStorage {
|
|||||||
|
|
||||||
async fn create_session(&self, working_dir: PathBuf, description: String) -> Result<Session> {
|
async fn create_session(&self, working_dir: PathBuf, description: String) -> Result<Session> {
|
||||||
let today = chrono::Utc::now().format("%Y%m%d").to_string();
|
let today = chrono::Utc::now().format("%Y%m%d").to_string();
|
||||||
let session_id = sqlx::query_as(
|
Ok(sqlx::query_as(
|
||||||
r#"
|
r#"
|
||||||
INSERT INTO sessions (id, description, working_dir, extension_data)
|
INSERT INTO sessions (id, description, working_dir, extension_data)
|
||||||
VALUES (
|
VALUES (
|
||||||
@@ -651,13 +650,7 @@ impl SessionStorage {
|
|||||||
.bind(&description)
|
.bind(&description)
|
||||||
.bind(working_dir.to_string_lossy().as_ref())
|
.bind(working_dir.to_string_lossy().as_ref())
|
||||||
.fetch_one(&self.pool)
|
.fetch_one(&self.pool)
|
||||||
.await?;
|
.await?)
|
||||||
|
|
||||||
sqlx::query("PRAGMA wal_checkpoint")
|
|
||||||
.execute(&self.pool)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
Ok(session_id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_session(&self, id: &str, include_messages: bool) -> Result<Session> {
|
async fn get_session(&self, id: &str, include_messages: bool) -> Result<Session> {
|
||||||
|
|||||||
Reference in New Issue
Block a user