Skip to content

Commit

Permalink
Merge pull request #566 from EspressoSystems/jb/connection-closed
Browse files Browse the repository at this point in the history
Automatically reset postgres connection when closed
  • Loading branch information
jbearer authored Jun 11, 2024
2 parents aa0eb37 + a821d74 commit b4fe8bf
Show file tree
Hide file tree
Showing 6 changed files with 748 additions and 276 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

[package]
name = "hotshot-query-service"
version = "0.1.38"
version = "0.1.39"
authors = ["Espresso Systems <hello@espressosys.com>"]
edition = "2021"
license = "GPL-3.0-or-later"
Expand Down
13 changes: 4 additions & 9 deletions src/data_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,18 +1105,13 @@ pub mod status_tests {
// Start consensus and wait for the transaction to be finalized.
network.start().await;

// Now wait for at least one block to be finalized.
let block_height = ds.read().await.block_height().await.unwrap();
// Now wait for at least one non-genesis block to be finalized.
loop {
let current_height = ds.read().await.block_height().await.unwrap();
if current_height > block_height {
let height = ds.read().await.block_height().await.unwrap();
if height > 1 {
break;
}
tracing::info!(
current_height,
block_height,
"waiting for a block to be finalized"
);
tracing::info!(height, "waiting for a block to be finalized");
sleep(Duration::from_secs(1)).await;
}

Expand Down
5 changes: 2 additions & 3 deletions src/data_source/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use super::{
fetching,
storage::sql::{self, SqlStorage},
storage::sql::{self, Client, SqlStorage},
AvailabilityProvider, FetchingDataSource,
};
pub use crate::include_migrations;
Expand All @@ -29,7 +29,6 @@ use hotshot_types::traits::node_implementation::NodeType;
pub use refinery::Migration;
use std::borrow::Cow;
pub use tokio_postgres as postgres;
use tokio_postgres::Client;

pub use sql::{Config, Query, Transaction};

Expand Down Expand Up @@ -433,7 +432,7 @@ mod test {
// This function should be generic, but the file system data source does not currently support
// storing VID common and later the corresponding share.
#[async_std::test]
pub async fn test_vid_monotonicity() {
async fn test_vid_monotonicity() {
setup_test();

let storage = D::create(0).await;
Expand Down
Loading

0 comments on commit b4fe8bf

Please sign in to comment.