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

Caching issue is back #28057

Closed
somera opened this issue Nov 14, 2023 · 11 comments · Fixed by #28072
Closed

Caching issue is back #28057

somera opened this issue Nov 14, 2023 · 11 comments · Fixed by #28072
Labels
Milestone

Comments

@somera
Copy link

somera commented Nov 14, 2023

Description

I see this
2023/11/14 18:23:54 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 639.796µs
when I go to my profile and start page.

I'm using memcached.

Looks like #22281

Gitea Version

1.21.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.42.0

Operating System

Ubuntu 20.04.x

How are you running Gitea?

gitea-1.21.0-linux-amd64

Database

PostgreSQL

@somera somera changed the title Cashing issue is back Caching issue is back Nov 14, 2023
@lunny
Copy link
Member

lunny commented Nov 15, 2023

How many times the query occupied?

@somera
Copy link
Author

somera commented Nov 15, 2023

3289 times on the start page.

My start page needs

image

After the upgrade to 1.21.0. Like in #22299

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Nov 15, 2023

Do you have the full log?


I think I know the problem now. Will propose a fix.

@wxiaoguang
Copy link
Contributor

-> Fix system config cache expiration timing #28072

@lunny lunny added this to the 1.21.1 milestone Nov 15, 2023
@somera
Copy link
Author

somera commented Nov 15, 2023

Do you have the full log?

Do you still need that?

@wxiaoguang
Copy link
Contributor

Do you have the full log?

Do you still need that?

Not needed now, thank you very much!

@somera
Copy link
Author

somera commented Nov 15, 2023

@wxiaoguang why is the query (in my case 3228 times)

2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 984.36µs
2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 561.283µs
2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 635.435µs
2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 634.959µs

needed on the http://domain/git/org/orgname/dashboard page for every orga? For the orga list?

@wxiaoguang
Copy link
Contributor

Because the "cache time" is not updated correctly, it is a bug. That's why #28072 fixes it.

@somera
Copy link
Author

somera commented Nov 16, 2023

@wxiaoguang I know that this is fixed. But I try to understand why so much queries are needed on the Dashboard page for an orga. But it make no sense to show the orga list on the dashboard page.

lunny pushed a commit that referenced this issue Nov 16, 2023
To avoid unnecessary database access, the `cacheTime` should always be
set if the revision has been checked.

Fix #28057
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Nov 16, 2023
To avoid unnecessary database access, the `cacheTime` should always be
set if the revision has been checked.

Fix go-gitea#28057
@wxiaoguang
Copy link
Contributor

But I try to understand why so much queries are needed on the Dashboard page for an orga

The avatar module needs to read system settings to decide how to render an avatar. 1.21 contains an enhancement for the setting system, it brings the bug: the system setting revision was read again and again.

wxiaoguang added a commit that referenced this issue Nov 16, 2023
Backport #28072

To avoid unnecessary database access, the `cacheTime` should always be
set if the revision has been checked.

Fix #28057

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@somera
Copy link
Author

somera commented Nov 27, 2023

Now the start page need

image

Looks good.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 12, 2024
fuxiaohei pushed a commit to fuxiaohei/gitea that referenced this issue Jan 17, 2024
To avoid unnecessary database access, the `cacheTime` should always be
set if the revision has been checked.

Fix go-gitea#28057
silverwind pushed a commit to silverwind/gitea that referenced this issue Feb 20, 2024
To avoid unnecessary database access, the `cacheTime` should always be
set if the revision has been checked.

Fix go-gitea#28057
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants