Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jobs running in wrong timezone. #2

Closed
jarekwg opened this issue Apr 9, 2020 · 2 comments
Closed

Jobs running in wrong timezone. #2

jarekwg opened this issue Apr 9, 2020 · 2 comments

Comments

@jarekwg
Copy link
Member

jarekwg commented Apr 9, 2020

Jobs seem to run in wrong timezone. I schedule for 4AM, job runs at 2PM.

@jarekwg jarekwg changed the title Timing issues Jobs running in wrong timezone. Apr 9, 2020
@funkybob
Copy link
Contributor

Given your timezone is currently UTC+10, that difference suggests it's a timezone issue.

It appears croniter is TZ aware, and bronski is passing django.utils.timezone.now() for it to work from.

In [4]: from croniter import croniter                                                                                                                                       
# TZ naive
In [5]: djnow = timezone.now()                                                                                                                                              
# TZ aware
In [6]: now = datetime.datetime.now()                                                                                                                                       

In [7]: croniter('* * * * *', djnow).next()                                                                                                                                 
Out[8]: 1586739480.0

In [8]: croniter('* * * * *', now).next()                                                                                                                                   
Out[8]: 1586775480.0

@funkybob
Copy link
Contributor

I wonder if there's some discrepancy between your session's timezone and the default timezone for Django.

Can you read some values from the DB directly (NOT via Django's ORM) to see if the values are the UTC times you expect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants