Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): Added TCP alive probes to postgres source (#58383)

Tom Owersa4375aa306f4
diff --git a/posthog/temporal/data_imports/sources/postgres/postgres.py b/posthog/temporal/data_imports/sources/postgres/postgres.py
index 26412bcb5def..a13c8c7c90df 100644
--- a/posthog/temporal/data_imports/sources/postgres/postgres.py
+++ b/posthog/temporal/data_imports/sources/postgres/postgres.py
@@ -142,6 +142,10 @@ def _connect_to_postgres(
sslrootcert="/tmp/no.txt",
sslcert="/tmp/no.txt",
sslkey="/tmp/no.txt",
+ keepalives=1,
+ keepalives_idle=30,
+ keepalives_interval=10,
+ keepalives_count=5,
**kwargs,
)
except psycopg.OperationalError as e:
@@ -1479,6 +1483,10 @@ def postgres_source(
sslrootcert="/tmp/no.txt",
sslcert="/tmp/no.txt",
sslkey="/tmp/no.txt",
+ keepalives=1,
+ keepalives_idle=30,
+ keepalives_interval=10,
+ keepalives_count=5,
)
except psycopg.OperationalError as e:
if require_ssl and "SSL" in str(e):
@@ -1664,6 +1672,10 @@ def postgres_source(
sslcert="/tmp/no.txt",
sslkey="/tmp/no.txt",
cursor_factory=cursor_factory,
+ keepalives=1,
+ keepalives_idle=30,
+ keepalives_interval=10,
+ keepalives_count=5,
)
except psycopg.OperationalError as e:
if require_ssl and "SSL" in str(e):