fix: busy_timeout to play nice with litestream

This commit is contained in:
Jeremy Wall 2024-09-23 15:14:04 -04:00
parent 8000b7d317
commit df88c2b7bd

View File

@ -14,6 +14,7 @@
use async_std::sync::Arc; use async_std::sync::Arc;
use std::collections::BTreeSet; use std::collections::BTreeSet;
use std::str::FromStr; use std::str::FromStr;
use std::time::Duration;
use std::{collections::BTreeMap, path::Path}; use std::{collections::BTreeMap, path::Path};
use argon2::{ use argon2::{
@ -259,6 +260,7 @@ impl SqliteStore {
std::fs::create_dir_all(&path)?; std::fs::create_dir_all(&path)?;
let url = format!("sqlite://{}/store.db", path.as_ref().to_string_lossy()); let url = format!("sqlite://{}/store.db", path.as_ref().to_string_lossy());
let options = SqliteConnectOptions::from_str(&url)? let options = SqliteConnectOptions::from_str(&url)?
.busy_timeout(Duration::from_secs(5))
.journal_mode(SqliteJournalMode::Wal) .journal_mode(SqliteJournalMode::Wal)
.create_if_missing(true); .create_if_missing(true);
info!(?options, "Connecting to sqlite db"); info!(?options, "Connecting to sqlite db");