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 <noreply@anthropic.com>
This commit is contained in:
@@ -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} 条")
|
||||
|
||||
Reference in New Issue
Block a user