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

@@ -1,7 +1,7 @@
import os
import logging
from contextlib import asynccontextmanager
from fastapi import FastAPI, Query, HTTPException
from fastapi import BackgroundTasks, FastAPI, Query, HTTPException
from fastapi.middleware.cors import CORSMiddleware
from apscheduler.schedulers.background import BackgroundScheduler
@@ -110,11 +110,15 @@ def api_announcement_delete(ann_id: int):
# ── 수집 API ─────────────────────────────────────────────────────────────────
@app.post("/api/realestate/collect")
def api_collect():
result = collect_all()
def _run_collect_and_match():
collect_all()
run_matching()
return result
@app.post("/api/realestate/collect")
def api_collect(background_tasks: BackgroundTasks):
background_tasks.add_task(_run_collect_and_match)
return {"ok": True, "message": "수집 시작됨"}
@app.get("/api/realestate/collect/status")