Skip to content

Commit

Permalink
pcli: limit sqlite conns to 1
Browse files Browse the repository at this point in the history
  • Loading branch information
conorsch committed Dec 1, 2023
1 parent 58db0cc commit ec14f7a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/view/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ impl Storage {
conn.set_prepared_statement_cache_capacity(32);
Ok(())
});
Ok(r2d2::Pool::new(manager)?)
Ok(r2d2::Pool::builder()
// We set max_size=1 to avoid "database is locked" sqlite errors,
// when accessing across multiple threads.
.max_size(1)
.build(manager)?)
} else {
let manager = SqliteConnectionManager::memory();
// Max size needs to be set to 1, otherwise a new in-memory database is created for each
Expand Down

0 comments on commit ec14f7a

Please sign in to comment.