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

Improve commits list performance to reduce unnecessary database queries #33528

Merged
merged 8 commits into from
Feb 14, 2025

Conversation

lunny
Copy link
Member

@lunny lunny commented Feb 6, 2025

When listing commits, Gitea attempts to retrieve the actual user based on the commit email. Querying users one by one from the database is inefficient. This PR optimizes the process by batch querying users by email, reducing the number of database queries.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 6, 2025
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 6, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Feb 6, 2025
@lunny lunny force-pushed the lunny/performance_commit_list branch from 785b83a to 602be74 Compare February 9, 2025 02:24
@lunny lunny marked this pull request as ready for review February 9, 2025 02:48
@lunny lunny added the performance/speed performance issues with slow downs label Feb 9, 2025
@lunny lunny added this to the 1.24.0 milestone Feb 9, 2025
@lunny lunny changed the title Performance commit list Improve commits list performance to reduce unnecessary database queries Feb 12, 2025
@silverwind
Copy link
Member

Is there existing test coverage?

@lunny
Copy link
Member Author

lunny commented Feb 13, 2025

Is there existing test coverage?

Yes, there are already some tests for commits list UI or API and I added an extra test for it in 646d3cd

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 13, 2025
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 14, 2025
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 14, 2025
@lunny lunny merged commit 70327d6 into go-gitea:main Feb 14, 2025
26 checks passed
@lunny lunny deleted the lunny/performance_commit_list branch February 14, 2025 08:05
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 14, 2025
zjjhot added a commit to zjjhot/gitea that referenced this pull request Feb 17, 2025
* giteaofficial/main:
  Add API to support link package to repository and unlink it (go-gitea#33481)
  [skip ci] Updated translations via Crowdin
  Update JS and PY dependencies (go-gitea#33587)
  [chore] add git mailmap for proper attribution of authorship (go-gitea#33612)
  Move commits signature and verify functions to service layers (go-gitea#33605)
  add spacing between sign in button's icon and text (go-gitea#33609)
  enable literal string for code search (go-gitea#33590)
  [skip ci] Updated translations via Crowdin
  Artifacts download api for artifact actions v4 (go-gitea#33510)
  Fix bug when get commit (go-gitea#33602)
  Fix mirror bug (go-gitea#33597)
  Fix typo in HTML attribute (go-gitea#33599)
  Use default Git timeout when checking repo health (go-gitea#33593)
  Improve commits list performance to reduce unnecessary database queries (go-gitea#33528)
  Performance optimization for pull request files loading comments attachments (go-gitea#33585)
  Fix PR's target branch dropdown (go-gitea#33589)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/go Pull requests that update Go code performance/speed performance issues with slow downs size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants