fix(avito): scale per-anchor timeout for detail-enrich + durable SERP counters #1661
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#1661
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/avito-anchor-timeout-and-counters"
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
Fixes the spurious "avito_city_sweep = 0 lots / 5 errors" — avito was actually working (103 new listings + 30 detail-enriched on 2026-06-17), but the run counters lied.
Root cause (same class as #1659)
Each anchor is wrapped in
asyncio.wait_for(run_avito_pipeline(...), timeout=ANCHOR_TIMEOUT_SEC=240). SERP+save is fast (~30s), but detail-enrich (top-N via BrowserFetcher; avito anti-bot detail pages spin to the browser service's 60spage.gototimeout) blows the 240s budget → every anchorTimeoutErrors → the counter-aggregation block is skipped → SERP lots (already saved to DB) vanish from the run counters. Prod proof: the run was exactly 1200s = 5×240s, yet 103 listings landed and 30 enriched.Fix
ANCHOR_TIMEOUT_SEC + detail_top_n × 50s + (180s if enrich_houses)≈ 1420s for detail_top_n=20+houses. Anchors now complete instead of being guillotined._avito_anchor_phasescoroutine that writeslots_fetched/inserted/updatedto the sweep-level counters immediately aftersave_listings, before the houses/detail phases — so a detail-phase timeout no longer erases the SERP counts.ANCHOR_TIMEOUT_SECglobal unchanged (yandex/other paths keep their own logic).Test plan
fetch_around)Refs #759