gendesign/backend/app/workers/tasks
lekss361 8191a85102 fix(#231): address re-review blockers — per-instance semaphore + time_limit + test mocks
PR #260 second-opinion review 🔴 BLOCK → fixes:

1. nspd_bulk_client.py: _SEMAPHORE module-level → per-instance self._sem
   создаётся в __aenter__ под текущий event loop. Sequential asyncio.run()
   в search_by_quarter (11 layers × asyncio.run() per layer) bind'ил
   module-level semaphore к first loop'у → RuntimeError на втором вызове →
   все cells return_exceptions=True проглатывали → grid возвращал 0 features.

2. nspd_sync.py: harvest_quarter добавлен time_limit=900 (hard) рядом с
   soft_time_limit=600. Safety net если task игнорит SoftTimeLimitExceeded.

3. tests/test_nspd_client.py: добавлен _make_fake_grid_walk helper +
   monkeypatch NSPDClient.get_features_in_bbox_grid в 3 тестах
   (search_by_quarter_core_only / _with_zouit / _layers_fetched_with_risks).
   Без этого area layers били бы по живому NSPD API → CI flaky.

Tests: 37 passed, 1 skipped (3 area-dispatch + 34 grid-walk).
2026-05-17 10:13:34 +03:00
..
__init__.py add interactive parser of наш.дом.рф ЖК+flats with stealth Playwright 2026-04-27 17:58:40 +03:00
ekburg_permits_sync.py feat(permits): ЕКБ РНС/РВЭ xlsx parser + schema + ETL (#105 PR A) (#211) 2026-05-16 11:41:21 +00:00
noise_sync.py feat(site-finder): v3.2 — noise + air quality + wind analytics 2026-05-11 20:42:37 +03:00
nspd_denorm_backfill.py feat(nspd): denorm nspd_parcels + nspd_buildings tables (#94 PR3 of 4) 2026-05-16 20:20:03 +03:00
nspd_geo.py fix(nspd-geo): replace f-string bulk INSERT with parametrized batch execute (#123) 2026-05-14 23:29:12 +03:00
nspd_sync.py fix(#231): address re-review blockers — per-instance semaphore + time_limit + test mocks 2026-05-17 10:13:34 +03:00
objective_etl.py fix(worker): port objective_etl from psycopg2 → psycopg v3 2026-05-11 12:07:57 +03:00
poi_sync.py debug(poi-sync): DB breadcrumbs to nspd_geo_log for silent-fail diagnosis 2026-05-11 18:37:43 +03:00
pzz_sync.py feat(site-finder): ПЗЗ territorial zones from Rosreestr PKK6 + zoning in analyze 2026-05-11 21:51:51 +03:00
refresh_analytics.py fix(scrape): SQLAlchemy text() парсил ':00:' regex как named-param 2026-04-30 23:16:11 +03:00
scrape_cadastre.py perf(cadastre): freshness skip + grid-walk heartbeat + log noise reduction (#187) 2026-05-15 23:02:37 +03:00
scrape_kn.py fix(scraper): диагностируем «кнопка не работает» — Redis lock + task_received log 2026-04-28 23:17:42 +03:00
scrape_objective.py feat(objective): full sync pipeline + dynamic admin config 2026-05-10 19:54:15 +03:00