: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(data-imports): classify connect timeouts to our own db as transient (#116717)
Tom Owers5195a6a62e8d
diff --git a/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.py b/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.pyindex 178b7f86e8df..0d9daa980a33 100644--- a/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.py+++ b/products/warehouse_sources/backend/temporal/data_imports/tests/test_util.py@@ -1017,6 +1017,11 @@ async def test_delete_folder_treats_an_already_deleted_folder_as_done(mock_captuDjangoOperationalError("server closed the connection unexpectedly"),True,),+ (+ "connect_timeout",+ DjangoOperationalError("connection timeout expired"),+ True,+ ),("rejected_password",DjangoOperationalError('connection failed: FATAL: password authentication failed for user "fake_user"'),diff --git a/products/warehouse_sources/backend/temporal/data_imports/util.py b/products/warehouse_sources/backend/temporal/data_imports/util.pyindex f1099d0ab74f..57e541aae646 100644--- a/products/warehouse_sources/backend/temporal/data_imports/util.py+++ b/products/warehouse_sources/backend/temporal/data_imports/util.py@@ -166,6 +166,12 @@ _TRANSIENT_INTERNAL_DB_MARKERS = (# Nothing accepts a connection on the port, because the pooler or the database is restarting# or its endpoint is being re-pointed."connection refused",+ # psycopg raises this only while establishing a connection, never mid-query. Every caller here+ # reconnects to a database it was already talking to moments earlier, so a connect-time timeout+ # is our own database being momentarily slow to accept, not a config problem. Mirrors+ # `_is_connect_timeout_error` in products/warehouse_sources_queue/backend/core/batch_consumer.py,+ # which treats a connect timeout on the queue DB connection the same way.+ "connection timeout expired",)# The tightest start_to_close timeout among the activities that use this is one minute, so the