From 327f77a7270fa964276a32bdbf99852db4122a3f Mon Sep 17 00:00:00 2001 From: Misaka_Company Date: Fri, 24 Jul 2026 11:10:45 +0800 Subject: [PATCH] fix(runtime): wrap ingest_enabled gate so _persist_to_db never raises Move the store.ingest_enabled() gate inside the main try/except. Previously it sat outside as a standalone block: ingest_enabled() -> _load_pg_config() raises FileNotFoundError when config.yaml is absent/malformed, which escaped _persist_to_db, was caught by dispatch_task's outer except, and flipped a successful download to FAILED -- violating the hook's never-raise invariant. Now config errors print a [warn], record ok=False, and return silently. Co-Authored-By: Claude --- inbound_verify/runtime.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/inbound_verify/runtime.py b/inbound_verify/runtime.py index 70a35b4..264b147 100644 --- a/inbound_verify/runtime.py +++ b/inbound_verify/runtime.py @@ -544,10 +544,10 @@ def _persist_to_db(site, kind): except Exception as e: print(f">> [warn] 入库模块不可用: {e}") return - if not store.ingest_enabled(): - print(">> [入库] 已关闭 (auto_ingest=false),跳过") - return try: + if not store.ingest_enabled(): # 移入 try:config.yaml 缺失/损坏时也不外抛 + print(">> [入库] 已关闭 (auto_ingest=false),跳过") + return count = store.ingest_task(site, kind) state_store.set_ingest_state(site, kind, ok=True, count=count) print(f">> [入库] {site}/{kind} 成功,{count} 条")