]> source.dussan.org Git - gitea.git/commit
Cache repository default branch commit status to reduce query on commit status table...
authorLunny Xiao <xiaolunwen@gmail.com>
Wed, 6 Mar 2024 12:17:19 +0000 (20:17 +0800)
committerGitHub <noreply@github.com>
Wed, 6 Mar 2024 12:17:19 +0000 (12:17 +0000)
commite308d25f1b2fe24b4735432b05e5e221879a2705
tree24abb4223c41fb82254b14a7520e8a2859fe4263
parent90a3f2d4b7ed3890d9655c0334444f86d89b7b30
Cache repository default branch commit status to reduce query on commit status table (#29444)

After repository commit status has been introduced on dashaboard, the
most top SQL comes from `GetLatestCommitStatusForPairs`.

This PR adds a cache for the repository's default branch's latest
combined commit status. When a new commit status updated, the cache will
be marked as invalid.

<img width="998" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/76759de7-3a83-4d54-8571-278f5422aed3">
routers/api/v1/repo/status.go
routers/web/repo/repo.go
services/repository/commitstatus/commitstatus.go [new file with mode: 0644]
services/repository/files/commit.go