perf(tradein): снять блокировку event loop на POST /estimate (#2207) #2225
No reviewers
Labels
No labels
admin
analytics
auth
automation
bug
business
chore
ci
compliance
data
data-moat
docs
duplicate
dx
enhancement
Fable 5 ревью
feedback/max
generative
GG-форсайт
needs-discussion
needs-human
observability
pause-bots
performance
priority/p0
priority/p1
priority/p2
priority/p3
scope/backend
scope/db
scope/devops
scope/frontend
scope/qa
scrapers
security
site-finder
stage/1
stage/2
status/blocked
status/done
status/needs-analysis
status/needs-fix
status/qa
status/ready
status/review
status/wip
tech-debt
tradein
ux
week ревью 1
wontfix
вторичка
ИРД
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: lekss361/gendesign#2225
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-estimate-event-loop"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
async estimate_qualityвыпускал ~28 синхронных psycopg PostGIS-запросов прямо на event loop; прод — один uvicorn worker → одна медленная оценка (холодный кэш, wide-radius fallback) стопила все конкурентные запросы, включая/health.await asyncio.to_thread(...)(паттерн geocoder.py), строго последовательно — Session не используется конкурентно (никакого gather на DB-хелперах)._backfill_house_fias) целиком внутри одного потока; INSERT + IMV-UPDATE +db.commit()сгруппированы атомарно в один to_thread (побочно улучшает атомарность persist-фазы)._price_from_inputs,_fetch_analogs,_fetch_anchor_comps,_fetch_dkp_corridor,_fetch_house_imv_anchor) не тронуты — backtest-harness и frozen CI-регресс-гейт работают как раньше. Pricing-логика не изменена (перенос исполнения, не поведения)._fetch_analogs→time.sleep(0.3), конкурентная лёгкая корутина завершается за <0.25s (при блокировке было бы ≥0.3).Как проверено
/estimateизнутри контейнера +/healthостаётся отзывчивым.Refs #2207