feat(avito): incremental SERP pagination with date early-stop (param-gated, default off) #1766
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#1766
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "feat/avito-incremental-pagination"
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?
What
Adds an opt-in incremental mode to the Avito exhaustive SERP walker.
fetch_all_secondary(..., since: date | None = None):since=None(default) → exactly today's exhaustive bisection walk. Zero behavior change.since=<date>→ per (room × seed-bracket), paginate sequentially newest-first and stop early once a page has no card newer thansince. Skips deep pagination (page 20–31) entirely — which is precisely the source of the 403 ban clusters that killed runs 211/212.No scheduler/schedule change in this PR — the engine ships dormant. Wiring
run_avito_full_load+ a split schedule (incremental daily + exhaustive weekly) is a separate follow-up, to flip only after this engine is proven on a manual incremental run.Why
Prod data: of 4359 active vtorichka, only ~431 are new/day (~10%). A full pass re-paginates the whole catalog deep every time (99.6% re-saves), and the deep pages are where 403s cluster. Incremental reads only the fresh top pages → ~4× fewer requests and, more importantly, shallow (page 1–2) so the deep-pagination ban vector disappears.
Delisting (
is_active=falseafter 10-day TTL) still needs a periodic full pass to refreshlast_seen_at— hence the planned daily-incremental + weekly-exhaustive split (next PR), which fits the 10-day TTL with margin.Design notes
s=104) + per-cardlisting_date(fromsortTimeStamp) make date early-stop sound.Nonelisting_date doesn't stop on its own; a 2-consecutive-undated-page streak triggers a grace stop (runaway guard).AvitoBlockedError/AvitoRateLimitedErrorpropagate as in the leaf bucket._walk_price_range/_paginate_leaf_bucketuntouched.Tests
New
tests/scrapers/test_avito_incremental_pagination.py(8 tests): early-stop at the first all-older page (page 4 not fetched), no-stop-when-all-fresh, all-None grace bound, single-undated-page doesn't stop,secondary_onlyfilter, block propagation, andsince=None→exhaustive path spy (asserts_walk_price_rangeused, incremental method not).tests/scrapers/ -k avito: 65 passed. Ruff clean.