fix(avito): scale per-anchor timeout for detail-enrich + durable SERP counters #1661

Merged
lekss361 merged 1 commit from fix/avito-anchor-timeout-and-counters into main 2026-06-17 06:07:50 +00:00

1 commit

Author SHA1 Message Date
40c044e2a6 fix(avito-sweep): scale per-anchor timeout by detail budget + preserve SERP counters before detail phase
All checks were successful
CI / changes (push) Successful in 7s
CI / backend-tests (push) Has been skipped
CI / frontend-tests (push) Has been skipped
CI / openapi-codegen-check (push) Has been skipped
CI / changes (pull_request) Successful in 6s
CI / backend-tests (pull_request) Has been skipped
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
- Compute _avito_anchor_timeout = ANCHOR_TIMEOUT_SEC + detail_top_n * 50s + 180s (houses).
  Eliminates false TimeoutError on anchors with many detail requests.
- Refactor run_avito_city_sweep to use inner _avito_anchor_phases coroutine (mirrors
  Yandex/Cian pattern): counters updated immediately after SERP+save (nonlocal), before
  detail phase. TimeoutError in detail no longer erases lots_fetched/inserted.
- Add consecutive-detail-timeout abort after 5 consecutive TimeoutErrors.
- Update test_anchor_watchdog: new tests for timeout scaling formula and counter durability.
- Update test_avito_anti_bot + test_sweep_imv_phase: patch AvitoScraper.fetch_around
  directly (run_avito_city_sweep no longer calls run_avito_pipeline); use ExitStack
  instead of starred-expression unpacking (invalid syntax in Python 3.12/3.14).
2026-06-17 09:02:11 +03:00