fix(realestate-lab): 코드 리뷰 이슈 수정 — 신규 추적, 보안, 비동기, 매칭 상태 보존

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 08:43:27 +09:00
parent 3b118725ca
commit bdfcdee5fd
4 changed files with 58 additions and 23 deletions

View File

@@ -145,8 +145,10 @@ def collect_all() -> Dict[str, Any]:
for raw in detail_rows:
try:
parsed = _parse_apt_detail(raw)
upsert_announcement(parsed)
_, is_new = upsert_announcement(parsed)
total_count += 1
if is_new:
new_count += 1
except Exception as e:
logger.error("공고 upsert 실패 [%s]: %s", detail_ep, e)
@@ -158,8 +160,6 @@ def collect_all() -> Dict[str, Any]:
upsert_model(parsed)
except Exception as e:
logger.error("모델 upsert 실패 [%s]: %s", model_ep, e)
new_count = total_count # 첫 수집 시 전부 신규로 기록
save_collect_log(new_count, total_count)
logger.info("수집 완료: new=%d, total=%d", new_count, total_count)
return {"new_count": new_count, "total_count": total_count}