Describe explicit minute 0 when seconds are not implicit - #717
Open
austek wants to merge 1 commit into
Open
Conversation
Minute 0 was always suppressed as an implied default, so an expression firing on a sub-minute schedule lost the minute bounding it. "* 0 9-23 * * ?" described as "every second every hour between 9 and 23", roughly sixty times the firings it actually produces. Only suppress minute 0 when the seconds are implicit too. Also fixes "5 0 9-23 * * ?", "0/5 0 * * * ?" and "* 0 */4 * * ?", and covers the deliberate suppression cases so they stay collapsed. Makes the strategy set insertion ordered and hoists the duplicated predicate call while here. Refs jmrozanec#3
3 tasks
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 of your changes
TimeDescriptionStrategyalways suppressed the minute when it wasOn(0), treating minute 0 as an implied default. That reads well when the seconds are implicit too, but when they are not, the description asserts a sub-minute frequency with nothing bounding it to the minute the cron actually fires on:This is the case reported in #3 by @natrajmolala, where you invited a PR with a test.
The fix gates the existing suppression on the seconds also being default. Three related expressions were wrong in the same way and are corrected by the same condition:
5 0 9-23 * * ?0/5 0 * * * ?* 0 */4 * * ?Where the suppression is deliberate it is preserved —
0 0 9-23 * * ?still describes as "every hour between 9 and 23" and0 0 10 * * ?as "at 10:00".Issue3Testpins those too, so the collapse cannot regress.Scope
#3 is an umbrella issue and this closes one reported case out of four; the others are phrasing rather than correctness, so the commit says
Refs #3rather thanFixes.Incidental
The strategy set is now insertion ordered and the duplicated predicate call in the match loop is hoisted. Both are hardening only — the eleven registered predicates cover mutually exclusive
(hours, minutes, seconds)type triples, so the previousHashSetiteration order was not reachable as nondeterministic output.Impact Analysis
Output changes only for expressions that fire on an explicit minute 0 with non-default seconds, which were describing roughly sixty times the firings they actually produce. Callers asserting on those exact strings will need updating. No API, parser or i18n bundle changes, so no new resource keys and no impact on the non-English locales.
Checklist