gendesign/tradein-mvp/backend/tests/tasks
bot-backend e3adcd47be
All checks were successful
CI / changes (pull_request) Successful in 7s
CI / frontend-tests (pull_request) Has been skipped
CI / openapi-codegen-check (pull_request) Has been skipped
CI / backend-tests (pull_request) Has been skipped
fix(tradein/avito): hard-timeout on detail-backfill fetch — prevent zombie-hang (#1950)
Prod run 423 завис на 7.7ч (healthy ~2.4ч) → reaped как zombie → detail-backlog
не уменьшился (21456 листингов ждут detail, 29.3% enriched).

Корень: fetch_detail(...) в loop'е без hard-timeout. Один зависший fetch
(camoufox/browser hang или curl-stall) блокировал loop навсегда → budget-guard
(раз в итерацию) не срабатывал → heartbeat (раз в 25 attempts) не обновлялся
→ run zombie. Вторичный hang-вектор: _rotate_ip() на блок — тоже без timeout.

Fix:
- asyncio.wait_for(fetch_detail, timeout=avito_detail_fetch_timeout_s=90s):
  зависший fetch отменяется → TimeoutError → листинг failed, loop идёт дальше.
  TimeoutError ловится ДО общего Exception (TimeoutError ⊂ OSError ⊂ Exception),
  порядок: AvitoBlocked/RateLimited → TimeoutError → Exception.
- bound rotate: asyncio.wait_for(_rotate_ip, timeout=settle+30s) + try/except —
  зависший changeip не роняет run.
- config: avito_detail_fetch_timeout_s (ENV AVITO_DETAIL_FETCH_TIMEOUT_S).
- admin: POST /scrape/avito-detail-backfill (batch_size, budget_sec) — on-demand
  прогон/верификация (основной schedule window-gated 09-12 UTC).

Восстанавливает throughput detail-очереди (точные coords #1967 + house_type/kitchen).
2026-06-27 23:19:26 +03:00
..
__init__.py fix(tradein): geocode backfill + remove Avito exclusion from estimator (#490) 2026-05-23 20:03:48 +00:00
test_avito_detail_backfill.py fix(tradein/avito): hard-timeout on detail-backfill fetch — prevent zombie-hang (#1950) 2026-06-27 23:19:26 +03:00
test_backfill_listings_coords_geoportal.py feat(tradein): бэкфилл координат листингов из ekb_geoportal_buildings (street+house match) 2026-06-20 17:08:46 +03:00
test_cadastral_geo_match.py fix(cadastral): single-statement match UPDATE — OFFSET chunk skipped rows 2026-06-18 10:28:19 +03:00
test_geocode_missing.py fix(tradein): wire nightly geocode backfill для listings в in-app scheduler 2026-06-16 10:01:49 +03:00
test_newbuilding_enrich_backfill.py feat(tradein-scheduler): nightly newbuilding-enrichment schedule (#973) 2026-06-13 16:24:03 +05:00
test_yandex_address_backfill.py fix(tradein): yandex address-enrich — city-agnostic title regex (спутники ЕКБ) (#875) 2026-05-31 09:08:29 +00:00
test_yandex_detail_backfill.py fix(tradein): yandex detail backfill — заменить fetch_detail на curl_cffi+proxy 2026-06-16 14:05:22 +03:00
test_yandex_newbuilding_sweep.py fix(tradein): yandex sweep — guard ext_id=NULL перед fetch_jk + cleanup httpx (#974 review M1/M3) 2026-06-15 18:41:08 +03:00