Skip to content

Commit

Permalink
log on postgres reconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
grooviegermanikus committed Mar 20, 2024
1 parent de0383e commit 636dbfc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion benchrunner-service/src/postgres/postgres_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl PostgresSession {
log::info!("Connecting to Postgres");

if let Err(err) = connection.await {
log::error!("Connection to Postgres broke {err:?}");
log::error!("Connection to Postgres broke: {err:?}");
return;
}
log::debug!("Postgres thread shutting down");
Expand Down
2 changes: 2 additions & 0 deletions benchrunner-service/src/postgres/postgres_session_cache.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::sync::Arc;

Check warning on line 1 in benchrunner-service/src/postgres/postgres_session_cache.rs

View workflow job for this annotation

GitHub Actions / lite-rpc full build

Diff in /home/runner/work/lite-rpc/lite-rpc/benchrunner-service/src/postgres/postgres_session_cache.rs
use log::info;
use tokio::sync::RwLock;
use crate::postgres::postgres_session::{PostgresSession, PostgresSessionConfig};

Expand All @@ -20,6 +21,7 @@ impl PostgresSessionCache {
pub async fn get_session(&self) -> anyhow::Result<PostgresSession> {
let session = self.session.read().await;
if session.is_closed() {
info!("PostgreSQL session closed - reconnecting");
drop(session);
let session = PostgresSession::new(self.config.as_ref().clone()).await?;
*self.session.write().await = session.clone();
Expand Down

0 comments on commit 636dbfc

Please sign in to comment.