From 1cce32e7eb94af76f9c15164d0cbc4d81c0ce224 Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Sat, 19 Jul 2025 09:42:59 -0400 Subject: [PATCH] Increase database connection pool sqlite shouldn't actually care about the number of open connections, and it's not clear that we need a pool at all, but this seems like it may resolve the issues we're seeing timing out acquiring a connection. --- src/db/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/db/mod.rs b/src/db/mod.rs index d43e3c92..7043ebb0 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -120,7 +120,11 @@ impl Database { fn new(conn: SqliteConnectionManager, tempfile: Option) -> Fallible { let pool = Pool::builder() - .connection_timeout(Duration::from_secs(5)) + // By inspection we have 13 threads in production, so make sure each of them can get a + // connection. In practice some of those wouldn't acquire database connections (e.g., + // the ctrl-c thread) but this seems like a good idea regardless. + .max_size(20) + .connection_timeout(Duration::from_secs(30)) .error_handler(Box::new(ErrorHandler)) .build(conn)?;