erio
d218b6c2aa
refactor(ops-cleanup): 拆分 executor + table-driven + 提取常量 + 补测试
代码审查反馈:
1. 文件行数超标:ops_cleanup_service.go 594→413 行。
拆 opsCleanupPlan / deleteOldRowsByID / truncateOpsTable / isMissingRelationError
+ counts struct 到 ops_cleanup_executor.go (164 行)。
2. runCleanupOnce 89 行→30 行(table-driven):
用 []opsCleanupTarget 循环替代三组重复的 opsCleanupPlan → runOne → assign。
3. 魔法值提取常量:
opsCleanupDefaultSchedule / opsCleanupBatchSize / opsCleanupCronStopTimeout /
opsCleanupRunTimeout / opsCleanupHeartbeatTimeout。
ops_settings.go 中 "0 2 * * *" 也统一引用 opsCleanupDefaultSchedule。
4. 补 5 个缺失测试:
- Reload 未 Start 时 no-op
- Reload 已 Stop 后 no-op
- cleanupReloader==nil 时 Update 不 panic
- Start 重复调用幂等
- refreshEffectiveBeforeRun 正确更新 snapshot
2026-05-04 13:35:26 +08:00
..
2026-05-04 12:43:15 +08:00
2026-04-23 22:30:45 +08:00
2026-05-04 13:35:26 +08:00
2026-05-03 22:12:57 +08:00
2026-04-23 16:34:37 +08:00
2026-04-23 21:40:58 +08:00