db: these changes should make the "db locked" error less likely
relying more on the underlying storage to keep everything safe
This commit is contained in:
parent
6353d77360
commit
313be247d9
1 changed files with 5 additions and 1 deletions
|
@ -7,10 +7,12 @@ use serenity::{
|
|||
},
|
||||
prelude::TypeMapKey,
|
||||
};
|
||||
use sqlx::sqlite::SqliteJournalMode;
|
||||
use sqlx::{
|
||||
sqlite::{SqliteConnectOptions, SqlitePoolOptions, SqliteRow},
|
||||
Error, FromRow, Pool, Row, Sqlite,
|
||||
};
|
||||
use std::time::Duration;
|
||||
use std::{str::FromStr, sync::Arc};
|
||||
|
||||
pub struct DataBase;
|
||||
|
@ -226,7 +228,9 @@ pub async fn db_init(config: &Config) -> Result<Pool<Sqlite>, Error> {
|
|||
.connect_with(
|
||||
SqliteConnectOptions::from_str(&format!("sqlite://{database}"))?
|
||||
.foreign_keys(true)
|
||||
.create_if_missing(true),
|
||||
.create_if_missing(true)
|
||||
.journal_mode(SqliteJournalMode::Wal)
|
||||
.busy_timeout(Duration::from_secs(10)),
|
||||
)
|
||||
.await?;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue