Repository navigation
feat(sync): hourly ticker chain to bypass schedule event drops - #172
Merged
Merged
Conversation
- GitHub schedule 事件对公共仓库是 best-effort,实测本仓库每小时 cron (23 * * * *) 落地率仅 ~10%(每天 1~4 次,期望 24 次),每次延迟 8~59 分钟;每日 cron 也延迟 7~12 小时才落地。此前 8585190(错峰)、 3328cc5(timeout)两次补救只是缓解 - 新增 sync-ticker.yml:tick 睡到整点 :23 → workflow_dispatch 触发 sync-images → 自触发下一个 tick。dispatch 走 API 直达,不经过 schedule 事件队列;tick job 并发组保证任意时刻至多一条链(多余 dispatch 顶掉 pending,cancelled 收场属正常替换) - watchdog(每 2h schedule)兜底断链:最近 tick run 非 in_progress/ 刚结束时重新 bootstrap;tick 自触发失败重试 3 次并显式红 - sync-images.yml 的 cron 保留作免费冗余(per-src 并发组保证两种 触发来源互斥不重入);停链方法是禁用 workflow 而非 cancel run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
sync-images.yml的23 * * * *(每小时)从未按点触发。实测(2026-11-15 ~ 11-28):sync-readmes.yml(06:17Z)实测延迟 7~12 小时才落地根因是平台侧:GitHub 官方文档明确 schedule 事件在高负载下会延迟,负载够高时直接丢弃(丢的是事件,run 列表里看不到)。
85851900(cron 错峰到 :23)、3328cc5c(timeout 防上轮未结束时不再建新 run)两次补救只是缓解。workflow 配置层面无解,必须绕开 schedule 队列。方案
新增
sync-ticker.yml,用workflow_dispatch自链式触发做主时钟(API 直达,不经过 schedule 事件队列):sync-images.yml→ 自触发下一个 tick。tick job 并发组(1 running + 1 pending)保证任意时刻至多一条链;多余的 dispatch 只会顶掉 pending(cancelled 收场,正常替换非失败,与 per-src 并发同语义)。sync-images.yml保持不动:其 cron 保留作免费冗余(能落地多少算多少),per-src 并发组保证两种触发来源互斥不重入,digest 缓存按 run id 天然隔离。文档同步更新:README(结构树/同步频率说明/更新记录)、DESIGN.md §3.6、IMAGE_SYNC_GUIDE.md。
合入后操作(必做)
之后每小时整点 :23(UTC)应出现一个 event=
workflow_dispatch、actor=github-actions[bot]的sync-imagesrun。运维备忘
sync-tickerworkflow。只 cancel 正在 sleep 的 tick 没用,watchdog 数小时内会把链拉起来。