From 403826ca8d6ff5bb31cb7001950138212d386a51 Mon Sep 17 00:00:00 2001 From: Abdul Basit Date: Thu, 21 Nov 2024 04:04:48 +0500 Subject: [PATCH] set max_connections for tmp db options --- sequencer/src/api/sql.rs | 2 ++ sequencer/src/persistence/sql.rs | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/sequencer/src/api/sql.rs b/sequencer/src/api/sql.rs index 7846ac078..b4047e4ee 100644 --- a/sequencer/src/api/sql.rs +++ b/sequencer/src/api/sql.rs @@ -468,6 +468,7 @@ mod impl_testable_data_source { Options { postgres_options: opt, + max_connections: 10, ..Default::default() } } @@ -480,6 +481,7 @@ mod impl_testable_data_source { Options { sqlite_options: opt, + max_connections: 3, ..Default::default() } } diff --git a/sequencer/src/persistence/sql.rs b/sequencer/src/persistence/sql.rs index bcd876255..1d50e15d0 100644 --- a/sequencer/src/persistence/sql.rs +++ b/sequencer/src/persistence/sql.rs @@ -183,7 +183,7 @@ pub struct Options { #[clap( long, env = "ESPRESSO_SEQUENCER_DATABASE_MAX_CONNECTIONS", - default_value = "25" + default_value = "25" )] pub(crate) max_connections: u32, @@ -273,8 +273,7 @@ impl TryFrom for Config { cfg = cfg.pool(pool); } - // This results in a weird panic so it has been commented out for now. - // cfg = cfg.max_connections(opt.max_connections); + cfg = cfg.max_connections(opt.max_connections); cfg = cfg.idle_connection_timeout(opt.idle_connection_timeout); cfg = cfg.min_connections(opt.min_connections); cfg = cfg.connection_timeout(opt.connection_timeout);