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-04-22 14:56:56 +08:00
2026-04-25 20:39:58 -04:00
2026-05-04 11:43:00 +08:00
2026-02-08 12:05:39 +08:00
2026-02-08 12:05:39 +08:00
2026-03-27 14:33:05 +08:00
2026-04-26 04:57:34 +00:00
2026-05-03 22:58:26 +08:00
2026-05-03 22:12:57 +08:00
2026-05-03 20:33:13 +08:00
2026-05-04 13:35:26 +08:00
2026-03-17 15:38:18 +08:00
2026-03-09 19:55:18 +08:00
2026-04-05 17:11:01 +08:00
2026-04-23 15:13:57 +00:00