feat(logs): 视频轮询时间线落库(重启不丢)

- 新增 video_polls 表(video_id/ts/status/progress/ok/error/raw,索引 (video_id,ts))
- metrics.video_poll_push 同步落库(唯一写入点,同时保留内存态)
- _attach_polls 改为优先读库、回落内存;/logs/recent 补上 _attach_polls 调用
- 保留策略与 api_calls 共用 90 天
- 版本 2.9.7 → 2.9.8
This commit is contained in:
jidekin committed 2026-10-23 15:34:28 +08:00
1 parent e151e75fb9
commit 5c75d62a3e
4 files changed
+92 -10

No files matched your search

+6
View File
@@ -49,6 +49,12 @@ def video_poll_push(video_id: str, snap: dict) -> None:
dq = deque(maxlen=_VP_MAX_POLLS)
VIDEO_POLLS[video_id] = dq
dq.append(snap)
# 2026-10-23:同时落库 —— 内存态重启即丢,库里才持久(日志页优先读库)
try:
from app import calllog as _calllog
_calllog.store.add_poll(video_id, snap)
except Exception: # noqa: BLE001
pass
def video_polls(video_id: str) -> list[dict]: