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

@@ -2,7 +2,7 @@ import json
import logging
from typing import Dict, Any, List
from .db import get_profile, save_match_result, clear_match_results, _conn
from .db import get_profile, save_match_result, _conn
logger = logging.getLogger("realestate-lab")
@@ -120,8 +120,6 @@ def run_matching():
logger.info("매칭 스킵: 프로필이 설정되지 않음")
return
clear_match_results()
with _conn() as conn:
anns = conn.execute(
"SELECT * FROM announcements WHERE status IN ('청약예정', '청약중')"
@@ -149,4 +147,10 @@ def run_matching():
})
saved += 1
# 완료/결과발표 공고의 매칭 결과 정리
conn.execute(
"DELETE FROM match_results WHERE announcement_id NOT IN "
"(SELECT id FROM announcements WHERE status IN ('청약예정', '청약중'))"
)
logger.info("매칭 완료: %d건 공고 중 %d건 매칭됨", len(anns), saved)