🎉 New Pull Request to taskiq-python/taskiq by @juanmicl
✨ fix: skip schedules with invalid cron_offset instead of crashing the scheduler (#669)
📊 +22/-1
🌿 juanmicl:fix/scheduler-invalid-cron-offset-crash → master
Closes: #668
is_cron_task_now called ZoneInfo(offset) outside the try/except
that converts errors into CronValueError, and the scheduler loop only
catches CronValueError. One schedule with a non-IANA cron_offset
string (e.g. the natural spelling "UTC+3") raised
ZoneInfoNotFoundError out of SchedulerLoop.run and killed the whole
scheduler process.
With this change a bad offset goes through the same path as an invalid
cron expression: CronValueError is raised, the loop logs the existing
Cannot parse cron warning 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 on
master with ZoneInfoNotFoundError and 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, ruff
and mypy clean.
sent via relator