Merge pull request #85 from blockworks-foundation/postgres_fix

Postgres Fix
This commit is contained in:
galactus 2023-03-10 13:37:01 +01:00 committed by GitHub
commit 1d147c45fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -20,4 +20,4 @@ FROM debian:bullseye-slim as run
RUN apt-get update && apt-get -y install ca-certificates libc6
COPY --from=build /app/target/release/lite-rpc /usr/local/bin/
CMD lite-rpc --rpc-addr "$RPC_URL" --ws-addr "$WS_URL"
CMD lite-rpc --rpc-addr "$RPC_URL" --ws-addr "$WS_URL" -p

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,