Skip to content

feat(align): align 5h window refresh to cron targets - #3

Merged
ShawnKung merged 1 commit into
mainfrom
feat/align-refresh-time
Sep 7, 2026
Merged

ShawnKung merged 1 commit into
mainfrom
feat/align-refresh-time

Conversation

@ShawnKung

Copy link
Copy Markdown
Owner

Summary

  • 新增 align 子命令:管理多条 cron 目标,每条带 Docker 风格短 id 和自己的延时预算 max-delay(默认 90m),支持 add / list / delete <id|前缀> / clear / preview。
  • ping --if-5h-full 默认做“尽力而为”的相位对齐:满额且到达对齐时间后才 ping;--without-align 关闭对齐,恢复“满额即 ping”。不带 flag 的 ping 仍是立即执行。
  • 目标与每目标 max-delay 落盘到 ~/.config/limitping/config.json;新增 limitping_planned_ping_timestamp_seconds 指标上报未来 5 次计划 ping 时间。

Behavior matrix

命令 满额判断 对齐
ping 否 否(立即 ping)
ping --if-5h-full 是 默认开启
ping --if-5h-full --without-align 是 否(旧行为)

Test plan

  • gofmt、go build ./...、go vet ./...、go test ./... 全绿
  • align add/list/delete/clear 端到端验证,含每目标 max-delay 独立落盘与展示
  • ping --help 仅列出 --dry-run / --if-5h-full / --without-align
  • README 同步更新(能力列表、示例、对齐章节、指标表)

Add an `align` subcommand to manage cron targets (each with a Docker-style
short id and its own max-delay budget) and preview upcoming ping/refresh
times. `ping --if-5h-full` now does best-effort phase alignment by default,
pinging only once the window is full and the aligned time is reached;
`--without-align` restores the plain "ping when full" behavior.

Targets and per-target max-delay (default 90m) persist to
~/.config/limitping/config.json. Push planned ping timestamps as a new
metric for observability.
@ShawnKung
ShawnKung merged commit 5954e0a into main Sep 7, 2026
10 checks passed
ShawnKung added a commit that referenced this pull request Sep 7, 2026
feat(align): align 5h window refresh to cron targets
@ShawnKung
ShawnKung deleted the feat/align-refresh-time branch September 7, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant