fix: apply the pg keepalive settings to the postgres trigger connection (#11512)

Claude-Session: https://claude.ai/code/session_019cpWeGy8jRMtWqvuRBpgu4

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-10-04 11:41:12 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 711e08c1d2
commit 33f6de0cd2
2 changed files with 3 additions and 1 deletions
+1 -1
View File
@@ -1072,7 +1072,7 @@ impl TokioPgConnection {
/// Without these, a server that vanishes without closing the socket (a failover,
/// a dropped route) leaves a query waiting on a read for the OS default of two
/// hours. The server's kernel answers the probes, so a slow query is unaffected.
fn set_pg_keepalive(config: &mut tokio_postgres::Config) {
pub fn set_pg_keepalive(config: &mut tokio_postgres::Config) {
config
.keepalives(true)
.keepalives_idle(std::time::Duration::from_secs(60))
@@ -355,6 +355,8 @@ pub async fn get_raw_postgres_connection(
config.options(options);
}
windmill_common::set_pg_keepalive(&mut config);
let connector = build_tls_connector(ssl_mode, database.root_certificate_pem.as_ref())?;
let client = if let Some(connector) = connector {
let (client, connection) = config.connect(connector).await.map_err(to_anyhow)?;