fix: skip schedules with invalid cron_offset instead of crashing the scheduler - #669
Open
juanmicl wants to merge 2 commits into
Open
fix: skip schedules with invalid cron_offset instead of crashing the scheduler#669juanmicl wants to merge 2 commits into
juanmicl wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #669 +/- ##
==========================================
+ Coverage 82.63% 82.65% +0.01%
==========================================
Files 69 69
Lines 2730 2733 +3
==========================================
+ Hits 2256 2259 +3
Misses 474 474 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Closes: #668
is_cron_task_nowcalledZoneInfo(offset)outside thetry/exceptthat converts errors into
CronValueError, and the scheduler loop onlycatches
CronValueError. One schedule with a non-IANAcron_offsetstring (e.g. the natural spelling
"UTC+3") raisedZoneInfoNotFoundErrorout ofSchedulerLoop.runand killed the wholescheduler process.
With this change a bad offset goes through the same path as an invalid
cron expression:
CronValueErroris raised, the loop logs the existingCannot parse cronwarning and skips that schedule.Two regression tests cover invalid offset strings: the natural spelling
"UTC+3"and a typo'd timezone name ("Europa/Madrid"). Both fail onmaster with
ZoneInfoNotFoundErrorand pass with this change.Complements #625 (which fixes duration-string offsets at
model-validation time but leaves the runtime guard unhandled).
Validation: full suite passes (
pytest -q, 324 tests),black,ruffand
mypyclean.