Files
Nexus/docs/design/plans/2026-06-08-sync-log-purge.md
T
Nexus Agent 69068e2e39 feat(ops): server_batch 回收、sync_logs 清理与 Agent 安装跳过
部署对齐三项后端能力:启动/周期收尾僵尸批量任务、30 天推送日志 purge、已安装且版本不低于主站时跳过批量安装 Agent。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-08 15:23:03 +08:00

28 lines
752 B
Markdown

# 2026-06-08 — sync_logs 30 天自动清理
## 背景
设计标准 `design-standards.md` 规定 `sync_logs` 保留 30 天;代码仅有手动 `reconcile-stale-logs`,无自动 purge,表会无限增长。
## 方案
1. `SyncLogRepositoryImpl.purge_older_than(retention_days=30)` — 按 `started_at` 批量 DELETE(每批 1000 行)。
2. `sync_log_purge_loop` — primary worker 启动后立即执行一次,之后每 24h 重复。
## 涉及文件
- `server/infrastructure/database/sync_log_repo.py`
- `server/background/sync_log_purge.py`
- `server/main.py`
## 测试
```bash
pytest tests/test_sync_log_purge.py -q
bash scripts/local_verify.sh
```
## 回滚
移除 `main.py``sync_log_purge` 任务;已删除行不可恢复。