69068e2e39
部署对齐三项后端能力:启动/周期收尾僵尸批量任务、30 天推送日志 purge、已安装且版本不低于主站时跳过批量安装 Agent。 Co-authored-by: Cursor <cursoragent@cursor.com>
752 B
752 B
2026-06-08 — sync_logs 30 天自动清理
背景
设计标准 design-standards.md 规定 sync_logs 保留 30 天;代码仅有手动 reconcile-stale-logs,无自动 purge,表会无限增长。
方案
SyncLogRepositoryImpl.purge_older_than(retention_days=30)— 按started_at批量 DELETE(每批 1000 行)。sync_log_purge_loop— primary worker 启动后立即执行一次,之后每 24h 重复。
涉及文件
server/infrastructure/database/sync_log_repo.pyserver/background/sync_log_purge.pyserver/main.py
测试
pytest tests/test_sync_log_purge.py -q
bash scripts/local_verify.sh
回滚
移除 main.py 中 sync_log_purge 任务;已删除行不可恢复。