Skip to content

[ruby] preserve periodic occurrence schedules - #1537

Merged
bgentry merged 2 commits into
masterfrom
bg/ruby-periodic-schedule-fallback
Oct 25, 2026
Merged

bgentry merged 2 commits into
masterfrom
bg/ruby-periodic-schedule-fallback

Conversation

@bgentry

@bgentry bgentry commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Delayed periodic passes currently stamp jobs with insertion time, losing their original occurrence timestamps.

Default each job to its scheduled occurrence time while preserving schedules supplied by the constructor or job arguments. Preserve ordinary uniqueness and state preparation, with one argument-option lookup and insertion hooks receiving the final schedule. Use the actual first pass time for run_on_start, and retain scheduled occurrence times for later runs.

This is stacked on the internal driver timestamp contract in #1536.

Driver consumers need to compare persisted timestamps without inspecting
which database backend encodes them. Private SQL helpers also cannot be
forwarded through delegating driver wrappers.

Expose `normalize_time` and `time_precision` on the internal driver
contract. Share normalization with SQL timestamp encoding and SQLite
insertion formatting, preserving microsecond truncation on Postgres and
millisecond rounding on SQLite. Return precision as an exact duration in
seconds.

Shared driver examples cover persisted queue and job timestamps at
precision boundaries, UTC conversion, delegation, and the smallest
representable increment across both adapters and database engines.
@bgentry
bgentry force-pushed the bg/ruby-periodic-schedule-fallback branch from 616ab62 to d9796f6 Compare October 25, 2026 02:34
@bgentry
bgentry force-pushed the bg/ruby-periodic-schedule-fallback branch from d9796f6 to c18065f Compare October 25, 2026 02:45
Delayed periodic work currently uses insertion time instead of the
schedule's occurrence time.

Share the ordinary insertion pipeline and retain one argument-option
lookup. Preserve explicit constructor and argument schedules, along with
ordinary key and state preparation, then apply an occurrence fallback to
the stored schedule before insertion hooks run. Carry occurrence times
from the registry without changing its existing due-job API. Timestamp
initial startup work at its first pass and later work at its occurrence.

Cover option precedence with frozen objects, prepared keys and states,
late periodic passes, and delayed startup work.
@bgentry
bgentry changed the base branch from master to bg/ruby-driver-time-contract October 25, 2026 03:42
@bgentry
bgentry force-pushed the bg/ruby-periodic-schedule-fallback branch from c18065f to c2541e0 Compare October 25, 2026 03:43
Base automatically changed from bg/ruby-driver-time-contract to master October 25, 2026 04:43
@bgentry
bgentry marked this pull request as ready for review October 25, 2026 19:07
@bgentry
bgentry merged commit 702d9dd into master Oct 25, 2026
25 checks passed
@bgentry
bgentry deleted the bg/ruby-periodic-schedule-fallback branch October 25, 2026 19:07
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.

2 participants