routines: support a first-run timestamp anchor for interval routines
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 45/100
調査の方向性
Start in the WP_Agent_Routine class and the WP_Agent_Routine_Action_Scheduler_Bridge::register() method, which currently schedules the first action at time() plus stagger_offset(). Add an optional first_run arg, and check that stagger_offset(), recurrence_matches() and to_array() behave as the issue describes. Done means register() uses a future first_run only when it mints a new chain, stagger_offset() returns 0 when first_run is set, recurrence_matches() still compares only interval and expression, and the existing tests pass with new coverage for these cases.
索引モデルが issue の本文から書いたものです。
説明
Problem
WP_Agent_Routine has no way to declare a first-run timestamp for an interval routine. WP_Agent_Routine_Action_Scheduler_Bridge::register() always schedules the first action at time() + $routine->stagger_offset(). A consumer that needs a routine anchored to a wall-clock time (for example "weekly, first run next Thursday 15:00 UTC") can't express it with supported args. The only workaround is a cron expression.
Downstream impact: Extra-Chill/data-machine#3618. System schedules declare first_run_callback / first_run_arg (e.g. 'tomorrow midnight', 'next thursday 15:00 UTC'). Routines were silently ignoring them, so a weekly digest was about to fire 37 minutes after it was enabled instead of at its Thursday anchor.
Current consumer workaround (data-machine)
After register(), data-machine compares current_generation() from before and after the call. If a fresh chain was minted, it stores an anchored as_schedule_recurring_action() with the bridge's SCHEDULED_HOOK/GROUP, cancels the bridge's provisional recurring action through cancel(), and refreshes the cache through pending_by_routine(). This works, but it has two problems:
- it reaches past the backend abstraction into Action Scheduler directly;
- a provisional action exists for a few milliseconds before it is replaced. Its due time is
time() + stagger, which can be close to now, so a queue runner could claim it in that window.
Proposal
Add an optional first_run (int Unix timestamp) arg to WP_Agent_Routine for interval routines:
register()usesfirst_run(when it is in the future) instead oftime() + stagger_offset()only when it mints a new chain;first_runis not schedule-significant.recurrence_matches()keeps comparing only interval/expression, so a relative anchor recomputed on every boot never causes churn;stagger_offset()returns 0 whenfirst_runis set;to_array()exposes it.
After that ships, data-machine can drop its workaround and pass first_run straight through from FlowRoutines::system_routine_args().
- 主要言語
- PHP
- スター
- 33
- フォーク
- 9
- 平均マージ
- 36分
- マージ済み PR(30日)
- 13
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Automattic/agents-api のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Automattic/agents-api#564 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 1〜2日 初心者へのやさしさ 48/100
Automattic/agents-api#587 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
Automattic/agents-api#560 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
Automattic/agents-api#552 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
Automattic/agents-api#551 ·
メンテナーはふだん 1 日以内に返信
Automattic/agents-api の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
majorsilence/Reporting#493 ·
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
Automattic/safe-publish#764 ·
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
sync-en
難易度 1/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
Перевод устарел
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100