Skip to content

fix(db): only update fields when necessary for repo hot path writes#1416

Merged
ecrupper merged 2 commits intomainfrom
fix/repo-overwrites
Mar 16, 2026
Merged

fix(db): only update fields when necessary for repo hot path writes#1416
ecrupper merged 2 commits intomainfrom
fix/repo-overwrites

Conversation

@ecrupper
Copy link
Contributor

A few fixes here:

  • hook retry loop was not erroring ever because it would always hit the continue in the retry check and move on
  • only update repo data if it actually changed (in the webhook hot path). That repo write is useless 99% of the time.
  • introduce a PartialRepoUpdate so that concurrent servers are not writing stale counter data ever

@ecrupper ecrupper requested a review from a team as a code owner March 13, 2026 17:52
@codecov
Copy link

codecov bot commented Mar 13, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 39 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.31%. Comparing base (223855d) to head (f6a3d26).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
api/webhook/post.go 0.00% 31 Missing ⚠️
database/repo/create.go 0.00% 2 Missing and 2 partials ⚠️
database/repo/update_partial.go 81.81% 1 Missing and 1 partial ⚠️
scm/github/app_install.go 0.00% 1 Missing ⚠️
scm/github/repo.go 0.00% 1 Missing ⚠️

❌ Your project status has failed because the head coverage (58.31%) is below the target coverage (90.00%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1416      +/-   ##
==========================================
- Coverage   58.41%   58.31%   -0.10%     
==========================================
  Files         660      661       +1     
  Lines       25292    25290       -2     
==========================================
- Hits        14774    14748      -26     
- Misses       9833     9854      +21     
- Partials      685      688       +3     
Files with missing lines Coverage Δ
database/types/repo.go 86.04% <100.00%> (-2.98%) ⬇️
scm/github/app_install.go 0.00% <0.00%> (ø)
scm/github/repo.go 76.17% <0.00%> (ø)
database/repo/update_partial.go 81.81% <81.81%> (ø)
database/repo/create.go 57.14% <0.00%> (-9.53%) ⬇️
api/webhook/post.go 0.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@wass3rw3rk wass3rw3rk left a comment

Choose a reason for hiding this comment

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

couple of minor things but looks good

@ecrupper ecrupper merged commit 2c1c71f into main Mar 16, 2026
13 of 16 checks passed
@ecrupper ecrupper deleted the fix/repo-overwrites branch March 16, 2026 13:24
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.

3 participants