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 Time Drift Calculation #8236

Draft
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

max-muoto
Copy link
Contributor

@max-muoto max-muoto commented May 8, 2023

Note: Before submitting this pull request, please review our contributing
guidelines
.

Description

Fix bug discussed in #8207 but doing the time drift calculation in events in UTC as opposed to local times.

@codecov
Copy link

codecov bot commented May 8, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +1.99 🎉

Comparison is base (4bcac7a) 85.08% compared to head (6f0b53f) 87.08%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8236      +/-   ##
==========================================
+ Coverage   85.08%   87.08%   +1.99%     
==========================================
  Files         148      148              
  Lines       18455    18470      +15     
  Branches     2428     2525      +97     
==========================================
+ Hits        15703    16085     +382     
+ Misses       2475     2106     -369     
- Partials      277      279       +2     
Flag Coverage Δ
unittests 87.05% <100.00%> (+1.97%) ⬆️

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

Impacted Files Coverage Δ
celery/events/event.py 100.00% <100.00%> (ø)
celery/events/receiver.py 94.66% <100.00%> (+0.07%) ⬆️
celery/events/state.py 97.22% <100.00%> (ø)

... and 30 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@auvipy auvipy self-requested a review May 8, 2023 03:43
@max-muoto
Copy link
Contributor Author

@auvipy Still working on resolving some things here, but will ping you once it's ready.

@auvipy
Copy link
Member

auvipy commented May 8, 2023

I still can't see any fix except the introduction of a newly introduced variable

@max-muoto
Copy link
Contributor Author

max-muoto commented May 8, 2023

@auvipy Not totally done (also need to add test coverage), but the idea is that non_adjusted_timestamp is the timestamp except it never gets localized with utcoffset.

body['timestamp'] = adjust_timestamp(timestamp, offset) adjusts the timestamp with the provided utcoffset.

We use this new variable in the drift calculation to avoid the issues mentioned here: #8207

@max-muoto
Copy link
Contributor Author

@auvipy Basic implementation is done, let me know if what I said makes sense. Will add unit tests tomorrow if you think it looks good.

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

were you able to fix it?

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.

None yet

3 participants