fix: force statement_timeout=0 on all database connections (#9184)
Cloud SQL's connection pooler can return connections with stale session settings from previous clients. If any client (Datadog, monitoring tools, manual psql) sets statement_timeout, that setting persists on the pooled connection. This explicitly sets statement_timeout=0 via asyncpg's server_settings on every connection, ensuring consistent behavior regardless of connection pool state. 🤖 Generated with [Letta Code](https://letta.com) Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -44,6 +44,7 @@ if not settings.disable_sqlalchemy_pooling:
|
|||||||
"prepared_statement_name_func": lambda: f"__asyncpg_{uuid.uuid4()}__",
|
"prepared_statement_name_func": lambda: f"__asyncpg_{uuid.uuid4()}__",
|
||||||
"statement_cache_size": 0,
|
"statement_cache_size": 0,
|
||||||
"prepared_statement_cache_size": 0,
|
"prepared_statement_cache_size": 0,
|
||||||
|
"server_settings": {"statement_timeout": "0"},
|
||||||
}
|
}
|
||||||
# Only add SSL if not already specified in connection string
|
# Only add SSL if not already specified in connection string
|
||||||
if "sslmode" not in async_pg_uri and "ssl" not in async_pg_uri:
|
if "sslmode" not in async_pg_uri and "ssl" not in async_pg_uri:
|
||||||
|
|||||||
Reference in New Issue
Block a user