diff --git a/grpc-ingest/src/config.rs b/grpc-ingest/src/config.rs index 23e31387e..64ef42953 100644 --- a/grpc-ingest/src/config.rs +++ b/grpc-ingest/src/config.rs @@ -243,6 +243,16 @@ pub struct ConfigIngesterPostgres { deserialize_with = "deserialize_usize_str" )] pub max_connections: usize, + #[serde( + default = "ConfigIngesterPostgres::default_idle_timeout", + deserialize_with = "deserialize_duration_str" + )] + pub idle_timeout: Duration, + #[serde( + default = "ConfigIngesterPostgres::default_max_lifetime", + deserialize_with = "deserialize_duration_str" + )] + pub max_lifetime: Duration, } impl ConfigIngesterPostgres { @@ -253,6 +263,14 @@ impl ConfigIngesterPostgres { pub const fn default_max_connections() -> usize { 50 } + + pub const fn default_idle_timeout() -> Duration { + Duration::from_millis(75) + } + + pub const fn default_max_lifetime() -> Duration { + Duration::from_millis(125) + } } #[derive(Debug, Clone, Default, Deserialize)] diff --git a/grpc-ingest/src/postgres.rs b/grpc-ingest/src/postgres.rs index 07e0ff929..1077bc49b 100644 --- a/grpc-ingest/src/postgres.rs +++ b/grpc-ingest/src/postgres.rs @@ -14,6 +14,8 @@ pub async fn create_pool(config: ConfigIngesterPostgres) -> anyhow::Result