Skip to content

PeriodicTasks with a TZ are not running #875

Closed
@radoshi

Description

@radoshi

Hi,

We noticed a failure on all periodic tasks with a timezone set, after moving to 2.8.0. We believe this a regression caused by #844

Any tasks that keyed to a CrontabSchedule set in a specific timezone are not being scheduled.

For example:

def _get_crontab_schedule(
    minute: str = "*",
    hour: str = "*",
    day_of_month: str = "*",
    month_of_year: str = "*",
    day_of_week: str = "*",
    timezone: zoneinfo.ZoneInfo = zoneinfo.ZoneInfo("UTC"),
) -> CrontabSchedule:
    return CrontabSchedule.objects.get_or_create(
        minute=minute,
        hour=hour,
        day_of_month=day_of_month,
        month_of_year=month_of_year,
        day_of_week=day_of_week,
        timezone=timezone,
    )
...
    schedule_every_day_7_am_pst, _ = _get_crontab_schedule(
        minute="0",
        hour="7",
        timezone=zoneinfo.ZoneInfo("America/Los_Angeles"),
    )
    PeriodicTask.objects.update_or_create(...)

This task did not get scheduled.

IntervalSchedules seem fine. CrontabSchedule with a UTC also seems fine.

We're happy to try to do a minimal repro, though its a bit complicated, if that would be helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions