refactor(realestate): collect_listings MOLIT 전용화(네이버는 워커 ingest로 이전)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -168,20 +168,14 @@ def _fetch_naver_all() -> tuple:
|
||||
|
||||
|
||||
def collect_listings() -> dict:
|
||||
naver_ok = True
|
||||
new_count = total = 0
|
||||
molit_diag = naver_diag = None
|
||||
"""MOLIT 실거래(합법 baseline)만 수집. 네이버 호가는 naver-fetch 워커가
|
||||
/api/internal/realestate/listings-ingest로 push (spec 2026-07-09-naver-listing-worker)."""
|
||||
molit_diag = None
|
||||
try:
|
||||
_, molit_diag = _fetch_molit_all() # 실거래(합법)는 항상 우선 — 안전마진 baseline
|
||||
_, molit_diag = _fetch_molit_all()
|
||||
except Exception as e:
|
||||
molit_diag = f"exc={type(e).__name__}:{str(e)[:80]}"
|
||||
logger.error("MOLIT 수집 오류(안전마진 baseline): %s", e)
|
||||
try:
|
||||
new_count, total = _fetch_naver_all()
|
||||
except requests.RequestException as e:
|
||||
naver_ok = False
|
||||
naver_diag = f"{type(e).__name__}:{str(e)[:80]}"
|
||||
logger.warning("네이버 매물수집 skip(차단/오류) — 안전마진·실거래는 유지: %s", e)
|
||||
diag = f"molit[{molit_diag}] naver[{naver_diag or 'ok'}]"
|
||||
save_listing_collect_log(new_count, total, naver_ok, error=diag)
|
||||
return {"new_count": new_count, "total_count": total, "naver_ok": naver_ok, "diag": diag}
|
||||
diag = f"molit[{molit_diag}] naver[worker]"
|
||||
save_listing_collect_log(0, 0, None, error=diag)
|
||||
return {"new_count": 0, "total_count": 0, "naver_ok": None, "diag": diag}
|
||||
|
||||
Reference in New Issue
Block a user