fix(avito): proactive IP rotate at sweep start + raise max_rotations 2→4 (Datadome ban recovery) #1731
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#1731
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "fix/avito-proactive-ip-rotate"
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 chronic avito Datadome bans (active stuck at 444; daily sweeps
mark_banned/ 0 inserts). Root cause: the apw mobile IP goes Datadome-stale between daily sweeps → first anchors hit the firewall → reactive_rotate_ip(capped at max_rotations=2) can't recover → 3 consecutive blocks →mark_banned.Verified on prod (this session)
_rotate_ip/changeip works (returns fresh new_ip).lots_fetched=120, lots_inserted=55, errors_count=0, 0 bans. A fresh IP passes avito Datadome; the only gap was no rotate-at-start. (NOT a proxy-pool/ops problem.)Changes (avito.py + config.py — minimal, not base.py)
AvitoScraper.__aenter__: proactivelyawait self._rotate_ip()once at sweep start (first step, covers both browser + curl_cffi modes), guarded onavito_proxy_rotate_url, try/except so a failed rotate logs+proceeds._rotate_ipalreadyasyncio.sleep(9)s so the new IP is live before the first fetch.config.py:avito_proxy_max_rotations2 → 4 (more reactive recovery mid-sweep).Test plan
pytest -k "avito or config or rotate or sweep"→ 315 passed; ruff cleanRefs #1188