From 599e8a7e37051d9fd06748c3a1dbedc8a7f5149c Mon Sep 17 00:00:00 2001 From: jokimina Date: Sun, 24 Feb 2019 21:34:45 +0800 Subject: [PATCH] [Bugfix] crontab task timezone issue --- apps/ops/celery/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/ops/celery/utils.py b/apps/ops/celery/utils.py index 1fc2fc103..ea975af78 100644 --- a/apps/ops/celery/utils.py +++ b/apps/ops/celery/utils.py @@ -4,6 +4,7 @@ import json import os from django.conf import settings +from django.utils.timezone import get_current_timezone from django.db.utils import ProgrammingError, OperationalError from django_celery_beat.models import PeriodicTask, IntervalSchedule, CrontabSchedule @@ -49,7 +50,7 @@ def create_or_update_celery_periodic_tasks(tasks): raise SyntaxError("crontab is not valid") kwargs = dict( minute=minute, hour=hour, day_of_week=week, - day_of_month=day, month_of_year=month, + day_of_month=day, month_of_year=month, timezone=get_current_timezone() ) contabs = CrontabSchedule.objects.filter( **kwargs