Skip to content

Add cache for common package queries #22491

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

Merged
merged 7 commits into from
Apr 13, 2025

Conversation

KN4CK3R
Copy link
Member

@KN4CK3R KN4CK3R commented Jan 17, 2023

This adds a cache for common package queries in GetPackageDescriptor. Code which needs to process a list of packages benefits from this change. This skips 350 queries in the package integration tests for example.

@KN4CK3R KN4CK3R added type/enhancement An improvement of existing functionality topic/packages labels Jan 17, 2023
@KN4CK3R KN4CK3R added this to the 1.19.0 milestone Jan 17, 2023
@lunny
Copy link
Member

lunny commented Jan 19, 2023

Maybe we can wait #22294

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 19, 2023
@KN4CK3R
Copy link
Member Author

KN4CK3R commented Jan 19, 2023

I don't think this is related because this cache should only be valid within one request. If you cache these objects longer than that you may get problems with expired/updated values.

@lunny
Copy link
Member

lunny commented Jan 19, 2023

I don't think this is related because this cache should only be valid within one request. If you cache these objects longer than that you may get problems with expired/updated values.

Yes, it's the same. ContextCache means cache in one request.

@KN4CK3R
Copy link
Member Author

KN4CK3R commented Jan 19, 2023

Oh, my mistake. I mixed up that PR with the global cache.

@lunny
Copy link
Member

lunny commented Feb 21, 2023

I think this could be rewritten since #22294 merged.

@yardenshoham yardenshoham modified the milestones: 1.19.0, 1.20.0 Feb 22, 2023
@yardenshoham yardenshoham added the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Feb 22, 2023
@yardenshoham yardenshoham removed the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label May 1, 2023
@delvh delvh removed this from the 1.20.0 milestone Jun 4, 2023
@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 Sep 12, 2024
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Sep 12, 2024
@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 Apr 13, 2025
@wxiaoguang wxiaoguang added this to the 1.24.0 milestone Apr 13, 2025
@wxiaoguang
Copy link
Contributor

wxiaoguang commented Apr 13, 2025

I do not think the "context cache" could be used in this case (actually the context cache's design would cause problems in some cases, see the comments)

So I made some changes to introduce "EphemeralCache", it should be general enough and could be used to "skips xxx queries in the package queries".

@wxiaoguang wxiaoguang enabled auto-merge (squash) April 13, 2025 09:18
@wxiaoguang wxiaoguang merged commit a2651c1 into go-gitea:main Apr 13, 2025
26 checks passed
zjjhot added a commit to zjjhot/gitea that referenced this pull request Apr 14, 2025
* giteaofficial/main: (27 commits)
  fix github migration error when using multiple tokens (go-gitea#34144)
  Add package version api endpoints (go-gitea#34173)
  Fix incorrect file links (go-gitea#34189)
  Add cache for common package queries (go-gitea#22491)
  Allow admins and org owners to change org member public status (go-gitea#28294)
  Fix span svg layout (go-gitea#34185)
  fix webhook url (go-gitea#34186)
  Optimize overflow-menu (go-gitea#34183)
  Move and rename UpdateRepository (go-gitea#34136)
  Update milestones.tmpl (go-gitea#34184)
  [skip ci] Updated translations via Crowdin
  Refactor Git Attribute & performance optimization (go-gitea#34154)
  [skip ci] Updated translations via Crowdin
  fix(go-gitea#33711): cross-publish docker images to ghcr.io (go-gitea#34148)
  refactor organization menu (go-gitea#33928)
  feat: Add sorting by exclusive labels (issue priority) (go-gitea#33206)
  Fix vertical centering of file tree icons and use entryIcon for submodules/symlinks (go-gitea#34137)
  bugfix check for alternate ssh host certificate location (go-gitea#34146)
  Cache GPG keys, emails and users when list commits (go-gitea#34086)
  Set MERMAID_MAX_SOURCE_CHARACTERS to 50000 (go-gitea#34152)
  ...
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 topic/packages type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants