django-celery
django-celery copied to clipboard
tasks registered by Camera are shifted in time
this is possible bug related to timezone handling in Camera, theoretically that was fixed with the latest release, but what I can see in the code, there is a double timezone "verification".
File snapshot.py
, lines 86-97:
'eta': maybe_make_aware(maybe_iso8601(task.eta)),
'expires': maybe_make_aware(maybe_iso8601(task.expires)),
...
'tstamp': aware_tstamp(task.timestamp),
and then in lines 125-127:
for datefield in ('eta', 'expires', 'tstamp'):
# Brute force trying to fix #183
setattr(obj, datefield, maybe_make_aware(getattr(obj, datefield)))
ach... this piece of code is responsible:
def aware_tstamp(secs):
"""Event timestamps uses the local timezone."""
return maybe_make_aware(datetime.fromtimestamp(secs))
there should be utcfromtimestamp
, I'm not sure if only or there should be check against CELERY_ENABLE_UTC
and USE_TZ
from settings.
Do you have USE_TZ and ENABLE_UTC enabled?
In our settings:
USE_TZ = True
CELERY_ENABLE_UTC = USE_TZ