mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 13:48:11 +08:00
Merge pull request #353 from maerteijn/fix-mysql-naive-datetime-in-scheduler
Fix issue when using USE_TZ=False with MySQL
This commit is contained in:
+4
-1
@@ -16,6 +16,7 @@ import socket
|
|||||||
import traceback
|
import traceback
|
||||||
# Django
|
# Django
|
||||||
from django import db
|
from django import db
|
||||||
|
from django.conf import settings
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from multiprocessing import Event, Process, Value, current_process
|
from multiprocessing import Event, Process, Value, current_process
|
||||||
@@ -529,7 +530,9 @@ def scheduler(broker=None):
|
|||||||
next_run = next_run.shift(years=+1)
|
next_run = next_run.shift(years=+1)
|
||||||
if Conf.CATCH_UP or next_run > arrow.utcnow():
|
if Conf.CATCH_UP or next_run > arrow.utcnow():
|
||||||
break
|
break
|
||||||
s.next_run = next_run.datetime
|
# arrow always returns a tz aware datetime, and we don't want
|
||||||
|
# this when we explicitly configured django with USE_TZ=False
|
||||||
|
s.next_run = next_run.datetime if settings.USE_TZ else next_run.datetime.replace(tzinfo=None)
|
||||||
s.repeats += -1
|
s.repeats += -1
|
||||||
# send it to the cluster
|
# send it to the cluster
|
||||||
q_options['broker'] = broker
|
q_options['broker'] = broker
|
||||||
|
|||||||
Reference in New Issue
Block a user