Files
Nexus/docs/changelog/2026-06-07-sync-log-stale-running-fix.md
T

33 lines
1.2 KiB
Markdown
Raw Normal View History

# Changelog — 2026-06-07 推送历史「进行中」订正与异常落库
## 摘要
推送失败时 `sync_logs` 长期停留在 `running`(进行中),导致推送历史大量「进行中」。根因:rsync 进程启动异常(如容器缺 `rsync`)在 `_rsync_push` 抛出未捕获异常,终态未写入 DB。
## 动机
用户反馈推送历史里很多「进行中」;生产库核实 7/7 条均为 `running`,对应今日多次 rsync 缺失导致的推送尝试。
## 变更
- `sync_engine_v2.py``_rsync_push` 异常转为 `exit_code=-1`,保证 `sync_log` 落库为 `failed`
- `sync_log_repo.py`:订正卡住记录时兼容 MySQL naive UTC 与 aware datetime 相减
- `usePushLogs.ts`:「修复卡住记录」阈值 120 分钟 → 15 分钟
- 生产数据:7 条历史 `running` 已订正为 `failed`
## 涉及文件
- `server/application/services/sync_engine_v2.py`
- `server/infrastructure/database/sync_log_repo.py`
- `frontend/src/composables/push/usePushLogs.ts`
## 迁移 / 重启
- 需部署后端 + 前端构建
- 无 DB 迁移
## 验证
- 推送历史无残留「进行中」(或点「修复卡住记录」可订正 >15 分钟的卡住项)
- 模拟 rsync 失败时 `sync_logs.status` 应为 `failed` 而非 `running`