fix(gpodder_sqlite): force in-memory database to consist of only one connection

main
Jef Roosens 2025-03-19 14:58:04 +01:00
parent fe8939c07e
commit 22016fe0e9
No known key found for this signature in database
GPG Key ID: 21FD3D77D56BAF49
1 changed files with 4 additions and 0 deletions

View File

@ -98,6 +98,10 @@ pub fn initialize_db(path: impl AsRef<Path>, run_migrations: bool) -> Result<DbP
pub fn initialize_db_in_memory(run_migrations: bool) -> Result<DbPool, DbError> {
let manager = ConnectionManager::<SqliteConnection>::new(":memory:");
let pool = Pool::builder()
// An in-memory database is recreated for each opened connection, so we try to force only a
// single connection to stay alive
.min_idle(Some(1))
.max_size(1)
.connection_customizer(Box::new(AddQueryDebugLogs))
.build(manager)?;