poll connection first

This commit is contained in:
aniketfuryrocks 2023-03-10 17:49:03 +05:30
parent f22701302c
commit 7d5b7ef733
No known key found for this signature in database
GPG Key ID: FA6BFCFAA7D4B764
1 changed files with 6 additions and 6 deletions

View File

@ -98,6 +98,12 @@ impl PostgresSession {
let connector = MakeTlsConnector::new(connector);
let (client, connection) = tokio_postgres::connect(&pg_config, connector.clone()).await?;
tokio::spawn(async move {
if let Err(err) = connection.await {
log::error!("Connection to Postgres broke {err:?}");
};
});
let insert_block_statement = client
.prepare(
r#"
@ -128,12 +134,6 @@ impl PostgresSession {
)
.await?;
tokio::spawn(async move {
if let Err(err) = connection.await {
log::error!("Connection to Postgres broke {err:?}");
};
});
Ok(Self {
client,
insert_tx_statement,