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
Fix date_done timzone issue #8385
base: main
Are you sure you want to change the base?
Conversation
Thank you for the fix! |
Ok. We'll fix and add unit tests over the next week. |
@@ -460,7 +460,7 @@ def _get_result_meta(self, result, | |||
state, traceback, request, format_date=True, | |||
encode=False): | |||
if state in self.READY_STATES: | |||
date_done = datetime.utcnow() | |||
date_done = self.app.now() |
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.
as this is understandable what the change is going to do, it is important to add or change existing tests to pass the test suit pass
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.
+1 -- https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow is deprecated in Python 3.12
new tests? |
flake8...................................................................Failed
- hook id: flake8
- exit code: 1
celery/backends/base.py:12:1: F401 'datetime.datetime' imported but unused
celery/backends/base.py:12:1: F401 'datetime.timezone' imported but unused |
Also please notice "This branch cannot be rebased due to conflicts”. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #8385 +/- ##
==========================================
- Coverage 81.25% 77.40% -3.85%
==========================================
Files 149 138 -11
Lines 18554 17357 -1197
Branches 3166 2952 -214
==========================================
- Hits 15076 13436 -1640
- Misses 3191 3665 +474
+ Partials 287 256 -31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This PR fixes #4842 with my best friend @CodeSik.
celery_taskmeta.date_done
was being saved viautcnow()
, but we suggest changing it toapp.now()
to apply the value set inapp.conf.timezone
.