Repository navigation
schedulemanager: add nextRunTime math for per-schedule jobs - #4606
Merged
Merged
Conversation
Pure time math with no production callers yet (part of #4245): - MaxLookAhead (1h) bounds how far a schedule job schedules its successor; runGranularity (1m) must match the River ByPeriod used when inserting it. - timeSpan and ceilTo are small helpers for the candidates and the final rounding. - nextRunTime picks the earliest of rule boundaries (Rule.NextChange in the schedule zone), span edges, notification times and the grid-aligned look-ahead clamp (next whole lookAhead boundary in UTC, so concurrent jobs for one schedule agree on the target), pre-empted by any zone transition before it, rounded up to the minute in UTC. The result is always strictly after now and its minute bucket strictly advances, so a successor is never due at or before the job that scheduled it. TestCeilTo and TestNextRunTime (most of the diff) cover the rounding, the grid clamp, span and notification candidates, DST transitions (Chicago, Santiago) and that post-condition. Signed-Off-By: Nathaniel Caza <mastercactapus@gmail.com>
KatieMSB
approved these changes
Oct 27, 2026
nahumguess
approved these changes
Oct 27, 2026
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.
Description:
Adds a helper function that calculates the next time a schedule will change (i.e., when it should be scheduled for update)