強化 PChome legacy 配對重驗證
All checks were successful
CD Pipeline / deploy (push) Successful in 1m3s

This commit is contained in:
OoO
2026-05-19 22:18:32 +08:00
parent f8222006b8
commit 40ddf4eee0
5 changed files with 597 additions and 2 deletions

View File

@@ -2193,6 +2193,7 @@ def run_pchome_match_backfill_task():
from sqlalchemy import create_engine
from services.ai_product_pick_agent import generate_product_pick_list
from services.cache_manager import clear_dashboard_cache
from services.competitor_identity_revalidator import revalidate_existing_competitor_identities
from services.competitor_intel_repository import clear_competitor_intel_cache
from services.competitor_price_feeder import CompetitorPriceFeeder
@@ -2200,6 +2201,13 @@ def run_pchome_match_backfill_task():
logging.info(f"[Scheduler] [PChomeBackfill] 🚀 啟動待比對補抓任務 | {now_str}")
engine = create_engine(DATABASE_PATH)
revalidation_result = revalidate_existing_competitor_identities(
engine,
limit=500,
dry_run=False,
include_expired=True,
write_attempts=True,
)
feeder_result = CompetitorPriceFeeder(engine=engine).run_unmatched_priority(limit=120)
pick_result = generate_product_pick_list(engine, limit=50)
clear_dashboard_cache()
@@ -2213,12 +2221,17 @@ def run_pchome_match_backfill_task():
"errors": feeder_result.errors,
"duration_sec": feeder_result.duration_sec,
"history_written": feeder_result.history_written,
"identity_revalidated_fresh": revalidation_result.promoted_fresh,
"identity_revalidated_expired": revalidation_result.promoted_expired,
"identity_revalidation_rejected_low": revalidation_result.rejected_low_score,
"identity_revalidation_rejected_veto": revalidation_result.rejected_veto,
"pick_candidates": pick_result.candidates,
"pick_written": pick_result.written,
"status": "Success",
}
logging.info(
f"[Scheduler] [PChomeBackfill] ✅ 完成 | "
f"revalidated={revalidation_result.promoted_fresh}+{revalidation_result.promoted_expired} "
f"matched={feeder_result.matched}/{feeder_result.total_skus} "
f"history_written={feeder_result.history_written} "
f"pick_written={pick_result.written} "