Skip to content

Commit

Permalink
Merge pull request #174 from samply/feature/sql-conn-log
Browse files Browse the repository at this point in the history
log sql conn established
  • Loading branch information
enola-dkfz authored Oct 18, 2024
2 parents f316288 + c355b25 commit dfae48a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,19 @@ async fn get_db_pool() -> Result<Option<DbPool>,ExitCode> {

#[cfg(feature = "query-sql")]
async fn get_db_pool() -> Result<Option<DbPool>,ExitCode> {
use tracing::info;

if let Some(connection_string) = CONFIG.postgres_connection_string.clone() {
match db::get_pg_connection_pool(&connection_string, CONFIG.max_db_attempts).await {
Err(e) => {
error!("Error connecting to database: {}", e);
Err(ExitCode::from(8))
}
Ok(pool) => Ok(Some(pool)),

Ok(pool) => {
info!("Postgresql connection established");
Ok(Some(pool))
}
}
} else {
Ok(None)
Expand Down

0 comments on commit dfae48a

Please sign in to comment.