diff --git a/.env b/.env index f3429c5cd..aed305103 100644 --- a/.env +++ b/.env @@ -156,6 +156,3 @@ INTEGRATION_TEST_PROTO=http # Version of sequencer protocol we want to test. If this is set to # `03`, marketplace upgrade will be tested. INTEGRATION_TEST_SEQUENCER_VERSION=02 - - -ESPRESSO_SEQUENCER_DATABASE_MAX_CONNECTIONS=30 \ No newline at end of file diff --git a/sequencer/src/persistence/sql.rs b/sequencer/src/persistence/sql.rs index 96510b001..bcd876255 100644 --- a/sequencer/src/persistence/sql.rs +++ b/sequencer/src/persistence/sql.rs @@ -273,7 +273,8 @@ impl TryFrom for Config { cfg = cfg.pool(pool); } - cfg = cfg.max_connections(opt.max_connections); + // This results in a weird panic so it has been commented out for now. + // 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); @@ -570,8 +571,10 @@ impl SequencerPersistence for Persistence { async fn load_anchor_leaf( &self, ) -> anyhow::Result)>> { - let mut tx = self.db.read().await?; - let Some(row) = tx + let Some(row) = self + .db + .read() + .await? .fetch_optional("SELECT leaf, qc FROM anchor_leaf ORDER BY view DESC LIMIT 1") .await? else { @@ -598,9 +601,10 @@ impl SequencerPersistence for Persistence { async fn load_undecided_state( &self, ) -> anyhow::Result, BTreeMap>)>> { - let mut tx = self.db.read().await?; - - let Some(row) = tx + let Some(row) = self + .db + .read() + .await? .fetch_optional("SELECT leaves, state FROM undecided_state WHERE id = 0") .await? else { @@ -620,9 +624,10 @@ impl SequencerPersistence for Persistence { &self, view: ViewNumber, ) -> anyhow::Result>>> { - let mut tx = self.db.read().await?; - - let result = tx + let result = self + .db + .read() + .await? .fetch_optional( query("SELECT data FROM da_proposal where view = $1").bind(view.u64() as i64), ) @@ -640,8 +645,10 @@ impl SequencerPersistence for Persistence { &self, view: ViewNumber, ) -> anyhow::Result>>> { - let mut tx = self.db.read().await?; - let result = tx + let result = self + .db + .read() + .await? .fetch_optional( query("SELECT data FROM vid_share where view = $1").bind(view.u64() as i64), ) @@ -658,9 +665,12 @@ impl SequencerPersistence for Persistence { async fn load_quorum_proposals( &self, ) -> anyhow::Result>>> { - let mut tx = self.db.read().await?; - - let rows = tx.fetch_all("SELECT * FROM quorum_proposals").await?; + let rows = self + .db + .read() + .await? + .fetch_all("SELECT * FROM quorum_proposals") + .await?; Ok(BTreeMap::from_iter( rows.into_iter()