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 get system setting bug when enabled redis cache #22295

Merged
merged 4 commits into from
Jan 1, 2023

Conversation

lunny
Copy link
Member

@lunny lunny commented Dec 31, 2022

Fix #22281

In #21621 , Get[V] and Set[V] has been introduced, so that cache value will be *Setting. For memory cache it's OK. But for redis cache, it can only store string for the current implementation. This PR revert some of changes of that and just store or return a string for system setting.

@lunny lunny added type/bug skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. outdated/backport/v1.18 This PR should be backported to Gitea 1.18 labels Dec 31, 2022
@lunny lunny added this to the 1.19.0 milestone Dec 31, 2022
@lunny lunny added the backport/done All backports for this PR have been created label Dec 31, 2022
@codecov-commenter
Copy link

Codecov Report

❗ No coverage uploaded for pull request base (main@3fef47b). Click here to learn what that means.
The diff coverage is 68.75%.

@@           Coverage Diff           @@
##             main   #22295   +/-   ##
=======================================
  Coverage        ?   48.18%           
=======================================
  Files           ?     1043           
  Lines           ?   142378           
  Branches        ?        0           
=======================================
  Hits            ?    68602           
  Misses          ?    65596           
  Partials        ?     8180           
Impacted Files Coverage Δ
modules/cache/cache.go 44.32% <ø> (ø)
models/user/setting.go 56.09% <20.00%> (ø)
models/system/setting.go 53.14% <87.50%> (ø)
models/avatars/avatar.go 31.81% <100.00%> (ø)
models/user/avatar.go 53.62% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 31, 2022
@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 Dec 31, 2022
@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 Jan 1, 2023
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 1, 2023
lunny added a commit that referenced this pull request Jan 1, 2023
backport #22295, fix #22281

Co-authored-by: Lauris BH <lauris@nix.lv>
@lunny lunny merged commit a1c3074 into go-gitea:main Jan 1, 2023
@lunny lunny deleted the lunny/fix_system_setting_redis_cache branch January 1, 2023 16:06
zjjhot added a commit to zjjhot/gitea that referenced this pull request Jan 3, 2023
* upstream/main:
  Add deprecated warning for DISABLE_GRAVATAR and ENABLE_FEDERATED_AVATAR (go-gitea#22318)
  Unify hashing for avatar (go-gitea#22289)
  fix: code search title translation (go-gitea#22285)
  Update Gmail mailer configuration (go-gitea#22291)
  Fix due date rendering the wrong date in issue (go-gitea#22302)
  Fix get system setting bug when enabled redis cache (go-gitea#22295)
  Restructure `webhook` module (go-gitea#22256)
  Reminder for no more logs to console (go-gitea#22282)
  Fix bug of DisableGravatar default value (go-gitea#22296)
  Upgrade go-chi to v5.0.8 (go-gitea#22304)
  [skip ci] Updated licenses and gitignores
  Use ErrInvalidArgument in packages (go-gitea#22268)
  Changelog v1.18.0 (go-gitea#22215) (go-gitea#22269)
  Support estimated count with multiple schemas (go-gitea#22276)
  Add Gentoo to the from package providers (go-gitea#22284)
  Fix sitemap (go-gitea#22272)
  Add `sync_on_commit` option for push mirrors api (go-gitea#22271)
  Fix key signature error page (go-gitea#22229)
@lunny lunny removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Jan 3, 2023
lunny added a commit that referenced this pull request Jan 8, 2023
Unfortunately, #22295 introduced a bug that when set a cached system
setting, it will not affect.
This PR make sure to remove the cache key when updating a system
setting.

Fix #22332
lunny added a commit to lunny/gitea that referenced this pull request Jan 8, 2023
Unfortunately, go-gitea#22295 introduced a bug that when set a cached system
setting, it will not affect.
This PR make sure to remove the cache key when updating a system
setting.

Fix go-gitea#22332
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. outdated/backport/v1.18 This PR should be backported to Gitea 1.18 skip-changelog This PR is irrelevant for the (next) changelog, for example bug fixes for unreleased features. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Excessive queries to system_setting table causing slow load times
6 participants