fix(scrapers): avito_full_load краш (source_id-reconcile) + cian/yandex ban-ротация #1921
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#1921
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/scraper-resilience-upsert-rotation"
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?
Два «тихих убийцы недели» из аудита «Мера».
Коммит 1 (
197068c5) — avito_full_load краш UniqueViolationКорень (краш run 398 сегодня 13:47):
save_listingsделаетINSERT ON CONFLICT (dedup_hash). Когда контент существующего ad дрейфит → новыйdedup_hash→ SELECT по dedup пуст → INSERT → коллизия по(source,source_id)(listings_source_source_id_uq) →UniqueViolation→ весь прогон падает.Фикс: INSERT обёрнут в per-lot
db.begin_nested()SAVEPOINT; приIntegrityErrorна non-nullsource_id→ rollback + UPDATE by(source,source_id)с новымdedup_hash+контентом. NULL source_id (yandex) — старый путь. Один битый lot не роняет прогон. +7 тестов.Коммит 2 (
c1cdf396) — cian/yandex ban/stuck-ротация (зеркало avito #1790/#1848)Корень:
_rotate_proxy_ipбыл только avito. cian банится, yandex упирался в stuck-прокси — без ротации.Эмпирика (живой пробинг): cian-прокси auto-rotate (changeip+retry на block помогает), yandex manual+stuck (changeip оживляет, проверено).
Фикс:
_rotate_proxy_ipтеперьsource-aware ({source}_proxy_rotate_url+{source}_proxy_max_rotations, avito-fallback). Wire в cian detail-loop + yandex address-enrich loop (на ≥3 consecutive fail → changeip(source)+retry, bounded). Avito-путь не сломан. +cian_proxy_max_rotations=4,yandex_proxy_max_rotations=4. +7 тестов.Проверка
ruff clean, 14 новых тестов pass, 838 в keyword-suite, 0 регрессий.
Деплой
recreate tradein-backend + tradein-scraper. Аддитивно, без миграций. Env уже имеет rotate_url для cian/yandex. Cross-ref #1790, #1848, #1871, аудит скрейперов сессии.