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

Fix date_done timzone issue #8385

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Fix date_done timzone issue #8385

wants to merge 6 commits into from

Conversation

FKgk
Copy link

@FKgk FKgk commented Jul 21, 2023

This PR fixes #4842 with my best friend @CodeSik.
celery_taskmeta.date_done was being saved via utcnow(), but we suggest changing it to app.now() to apply the value set in app.conf.timezone.

@Nusnus
Copy link
Member

Nusnus commented Jul 22, 2023

Thank you for the fix!
Is it possible to add some unit tests to verify the change?

@CodeSik
Copy link

CodeSik commented Jul 22, 2023

Ok. We'll fix and add unit tests over the next week.

@Nusnus Nusnus self-requested a review July 22, 2023 21:46
@auvipy auvipy self-requested a review July 24, 2023 07:16
@@ -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()
Copy link
Member

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@auvipy
Copy link
Member

auvipy commented Nov 8, 2023

new tests?

@Nusnus
Copy link
Member

Nusnus commented Jan 12, 2024

@FKgk @CodeSik Can you check up on the PR please?

Thank you!

@Nusnus Nusnus mentioned this pull request Jan 14, 2024
@Nusnus
Copy link
Member

Nusnus commented Jan 15, 2024

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

@Nusnus
Copy link
Member

Nusnus commented Jan 15, 2024

Also please notice "This branch cannot be rebased due to conflicts”.

Copy link

codecov bot commented Jan 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0eb5d0e) 81.25% compared to head (f4c59ad) 77.40%.

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     
Flag Coverage Δ
unittests 77.39% <100.00%> (-3.84%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

Celery timezone use default UTC timezone ignoring settings.
5 participants