-
Notifications
You must be signed in to change notification settings - Fork 28
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: fetch accurate branch head #352
Conversation
b126832
to
5f0cd91
Compare
@@ -19,6 +20,8 @@ class BranchDetailSerializer(BranchSerializer): | |||
) | |||
|
|||
def get_head_commit(self, branch: Branch) -> CommitDetailSerializer: | |||
_ = get_or_update_branch_head(Commit.objects, branch, branch.repository_id) |
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.
_ = get_or_update_branch_head(Commit.objects, branch, branch.repository_id) | |
get_or_update_branch_head(Commit.objects, branch, branch.repository_id) |
5f0cd91
to
cc2e320
Compare
Codecov ReportAttention:
Changes have been made to critical files, which contain lines commonly executed in production. Learn more
Additional details and impacted files@@ Coverage Diff @@
## main #352 +/- ##
=====================================
Coverage 95.71 95.71
=====================================
Files 740 741 +1
Lines 16720 16746 +26
=====================================
+ Hits 16002 16027 +25
- Misses 718 719 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAttention:
📢 Thoughts on this report? Let us know! |
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #352 +/- ##
==========================================
- Coverage 96.05% 96.03% -0.02%
==========================================
Files 625 626 +1
Lines 16204 16230 +26
==========================================
+ Hits 15565 15587 +22
- Misses 639 643 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov Report
@@ Coverage Diff @@
## main #352 +/- ##
==========================================
- Coverage 96.05% 96.03% -0.02%
==========================================
Files 625 626 +1
Lines 16204 16230 +26
==========================================
+ Hits 15565 15587 +22
- Misses 639 643 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
please create an issue to revisit this implementation and remove if we don't need it anymore so we don't forget about this.
@joseph-sentry could you add a link to the incident perhaps in the code change? that would make future finding a little easier |
|
b1a41aa
to
3eeb437
Compare
This commit is a fix for the recent issue where branch heads were all set to the same value each time they were updated due to a bug in the Branch django model. This fix creates a helper function that checks for the 2 remaining innacurate commit shas that a large number of branches were set to. If the current branch head is set to one of those shas, we update the branch head by fetching the latest commit on that branch from the db. Note that we must use a raw sql query here to update the branch object because using the django ORM to update it would lead to the same issue we are trying to fix. Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
Signed-off-by: joseph-sentry <joseph.sawaya@sentry.io>
3eeb437
to
0f1426f
Compare
Purpose/Motivation
This commit is a fix for the recent issue where
branch heads were all set to the same value each
time they were updated due to a bug in the Branch
django model.
This fix creates a helper function that checks for the 2 remaining innacurate commit shas that a large number of branches were set to. If the current branch head is set to one of those shas, we update the branch head by fetching the latest commit on that branch from the db.
Note that we must use a raw sql query here to update the branch object because using the django ORM to update it would lead to the same issue we are trying to fix.
Incident to link to
https://status.codecov.com/incidents/z10fykg3c9w4
What does this PR do?
get_or_update_branch_head
get_or_update_branch_head
function in many endpoints most notably: graphs (badges) and the graphql branch endpoint