-
Notifications
You must be signed in to change notification settings - Fork 457
Consider server timezone on _get_timezone_offset instead of django's settings #886
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4526bd9
Scheduler shouldnt ignore specific times on crontab
iwalucas b6e39f6
Use aware_now to get server's timezone rather than using django's
iwalucas 040df6b
Update schedulers.py
iwalucas b257a3c
Update schedulers.py
iwalucas fca14a2
Update schedulers.py
iwalucas 068e88e
Update django_celery_beat/schedulers.py
auvipy 70d34ac
adding tests
iwalucas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
tzinfo
class does not define__str__
. It would be better to useserver_time.tzinfo.tzname()
which is guaranteed to exist.There's no guarantee
ZoneInfo
will know what to do with thetzname()
, though, so this won't work with obscure timezone implementations. (Edit: or with obscure zones not known to ZoneInfo. Either of these cases will probably break Django, so I don't think that this is a problem, just pointing it out.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would request to come with a better solution for this in a separate PR, as going to merge this for a hhotfix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change caused our environment to stop dispatching tasks #894 - this should not have been a patch upgrade
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you state in the docs that changing the timezone needs manual work https://django-celery-beat.readthedocs.io/en/latest/#important-warning-about-time-zones
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alirafiei75 can you also have a look into this please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
locally it is working - on the server, even if i update the server timezone to Europe/Berlin from UTC it doesn't work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@FabianClemenz We wrote some tests to make sure that timezone differences do not affect the tasks running. Can you check them and if possible add a failing test so that I can check what is the expectation? (so then I can fix it)
There was a serious bug in 2.8 and some of the developers that had the problem reviewed the PR #879 and you can see the comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@alirafiei75 i try to get time for that
For now
date
returns utc timezonetimezone.now()
shows utc timezone,timezone.get_current_timezone()
shows Europe/Berlindatetime.now()
shows Europe/BerlinMaybe this line is the error? Getting the current time via datetime instead of timezone?
django-celery-beat/django_celery_beat/schedulers.py
Line 503 in 673dbc5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localtime of beat shows time in Europe/Berlin - no matter what timezone the server is in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could not be the problem as it is not used anywhere else and just the timedelta matters and as long as both current_time and _last_full_sync are calculated in the same way, there won't be a problem.