Browse Source

Merge pull request #2432 from jokimina/patch-5

[Bugfix] celery beat crontab task timezone issue
pull/2438/head
老广 6 years ago committed by GitHub
parent
commit
a43314f5be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      apps/ops/celery/utils.py

3
apps/ops/celery/utils.py

@ -4,6 +4,7 @@ import json
import os import os
from django.conf import settings from django.conf import settings
from django.utils.timezone import get_current_timezone
from django.db.utils import ProgrammingError, OperationalError from django.db.utils import ProgrammingError, OperationalError
from django_celery_beat.models import PeriodicTask, IntervalSchedule, CrontabSchedule 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") raise SyntaxError("crontab is not valid")
kwargs = dict( kwargs = dict(
minute=minute, hour=hour, day_of_week=week, 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( contabs = CrontabSchedule.objects.filter(
**kwargs **kwargs

Loading…
Cancel
Save