fix: bug
This commit is contained in:
@@ -8,6 +8,7 @@ from datetime import datetime, timezone
|
||||
from typing import Callable, Optional, Tuple
|
||||
|
||||
from config import DB_PATH, API_BASE
|
||||
from db_writer import touch_situation_updated_at_path
|
||||
|
||||
|
||||
def _notify_api(api_base: str) -> bool:
|
||||
@@ -172,15 +173,18 @@ def run_full_pipeline(
|
||||
except Exception as e:
|
||||
print(f" [warn] 正文抓取: {e}")
|
||||
|
||||
# 4. 映射到前端库字段并更新表
|
||||
n_panel = write_updates(new_items) if new_items else 0
|
||||
# 4. 映射到前端库字段并更新表(与去重/AI 使用同一 db path)
|
||||
n_panel = write_updates(new_items, db_path=path) if new_items else 0
|
||||
if new_items:
|
||||
_extract_and_merge(new_items, path)
|
||||
|
||||
# 5. 通知(有新增时才通知;可选:先执行外部逻辑如 GDELT 回填,再通知)
|
||||
# 4.5 每次运行都刷新 situation.updated_at,便于前端显示「最后抓取时间」(否则只有新增条目时才更新,数据会一直停在旧日期)
|
||||
touch_situation_updated_at_path(db_path=path)
|
||||
|
||||
# 5. 通知(每次运行都通知,让 API 重载并广播最新 lastUpdated)
|
||||
if on_notify:
|
||||
on_notify()
|
||||
if notify and (n_panel > 0 or n_news > 0):
|
||||
if notify:
|
||||
_notify_api(base)
|
||||
|
||||
return len(items), n_news, n_panel
|
||||
|
||||
Reference in New Issue
Block a user