fix(tradein/avito): hard-timeout on detail-backfill fetch — prevent zombie-hang (#1950) #2028
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#2028
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/tradein-avito-detail-backfill-hang"
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
Прод-run detail-backfill (#423) завис 7.7ч → zombie (healthy ~2.4ч), backlog не двинулся (21 456 avito ждут detail, 29.3% enriched). Корень:
fetch_detailв loop'е был без hard-timeout — один зависший fetch (camoufox/curl-stall) блокировал loop навсегда, budget-guard (проверяется в начале итерации) и heartbeat (каждые 25) молчали →reap_zombiesкрасил весь run zombie.Фикс (
avito_detail_backfill.py):fetch_detail→asyncio.wait_for(timeout=avito_detail_fetch_timeout_s=90s); новыйexcept TimeoutError(передexcept Exception): листинг = failed +db.rollback()+ continue (один зависший листинг не роняет run).scraper._rotate_ip()→ boundedwait_for(timeout=settle+30)+ try/except (вторичный hang-вектор на changeip).avito_detail_fetch_timeout_s(ENV-override) в config.POST /scrape/avito-detail-backfill(batch_size/budget_sec, 409-guard на параллельный run) — для on-demand прогона/верификации (schedule window-gated 09-12 UTC).Test plan
:x::typetests/tasks/test_avito_detail_backfill.py→ 11 passed (incl.test_backfill_fetch_timeout_skips_and_continues— воспроизводит регрессию run 423: первый fetch висит → wait_for отменяет → failed; второй → enriched; loop не зависает, mark_done)docker exec tradein-backend curl -X POST localhost:8000/api/v1/admin/scrape/avito-detail-backfill?batch_size=200&budget_sec=600 -H "X-Authenticated-User: admin"→ run завершаетсяdoneс ненулевымenriched, heartbeat обновляетсяВосстанавливает throughput detail-очереди → точные координаты (#1967) + house_type/kitchen для avito. Refs #1950