Skip to content

Commit

Permalink
feat: increase acquire timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
alextes committed Nov 21, 2024
1 parent 17dcaf6 commit 4b36a9d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/phoenix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ async fn mount_health_route() -> Result<()> {
}

/// Get a database connection, retrying until we can connect. Send an alert if we can't.
async fn get_db_connection(
async fn connect_db(
db_url: &str,
retry_interval: &Duration,
max_retry_duration: &Duration,
Expand All @@ -239,7 +239,7 @@ async fn get_db_connection(
loop {
match PgPoolOptions::new()
.max_connections(3)
.acquire_timeout(std::time::Duration::from_secs(3))
.acquire_timeout(std::time::Duration::from_secs(9))
.connect(db_url)
.await
{
Expand Down Expand Up @@ -267,14 +267,14 @@ async fn run_ops_monitors() -> Result<()> {
let max_retry_duration = Duration::minutes(2);
let retry_interval = Duration::seconds(10);

let relay_pool = get_db_connection(
let relay_pool = connect_db(
&APP_CONFIG.relay_database_url,
&retry_interval,
&max_retry_duration,
)
.await?;

let mev_pool = get_db_connection(
let mev_pool = connect_db(
&APP_CONFIG.database_url,
&retry_interval,
&max_retry_duration,
Expand Down

0 comments on commit 4b36a9d

Please sign in to comment.