From 183053f8902c5e6e1712ab221bcf1317fad1daf4 Mon Sep 17 00:00:00 2001 From: bot-backend Date: Fri, 3 Jul 2026 13:28:52 +0500 Subject: [PATCH] =?UTF-8?q?fix(site-finder):=20SET=20LOCAL=20statement=5Ft?= =?UTF-8?q?imeout=20=D0=BB=D0=B8=D1=82=D0=B5=D1=80=D0=B0=D0=BB=D0=BE=D0=BC?= =?UTF-8?q?=20=E2=80=94=20bind=20=D0=BB=D0=BE=D0=BC=D0=B0=D0=BB=20nearby?= =?UTF-8?q?=5Fnetwork=5Fzones?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Postgres не принимает bind-параметры в SET (extended protocol → psycopg.errors.SyntaxError «at or near $1»), запрос падал и деградация отдавала [] на каждый вызов. Литерал из int-константы, как у offer_trend. Проверено на прод-БД через туннель: 66:41:0404019:4728 → 6 зон (thermal 3 м / 8 м, электро 58 м, газ 125 м). --- .../app/services/site_finder/connection_capacity_lookup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/app/services/site_finder/connection_capacity_lookup.py b/backend/app/services/site_finder/connection_capacity_lookup.py index 60e98369..155f5494 100644 --- a/backend/app/services/site_finder/connection_capacity_lookup.py +++ b/backend/app/services/site_finder/connection_capacity_lookup.py @@ -523,10 +523,9 @@ def _query_nearby_network_zones(db: Session, parcel_wkt: str) -> list[dict]: """ try: with db.begin_nested(): - db.execute( - text("SET LOCAL statement_timeout = :ms"), - {"ms": str(_NETWORK_ZONE_TIMEOUT_MS)}, - ) + # SET не принимает bind-параметры (extended protocol → syntax error + # at or near "$1") — только литерал, как у offer_trend (parcels.py). + db.execute(text(f"SET LOCAL statement_timeout = '{_NETWORK_ZONE_TIMEOUT_MS:d}'")) rows = ( db.execute( text(""" -- 2.45.3