mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
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="76759de7
-3a83-4d54-8571-278f5422aed3">
(cherry picked from commit e308d25f1b2fe24b4735432b05e5e221879a2705)
This commit is contained in:
parent
a8f5449cd9
commit
95e682f104
4 changed files with 145 additions and 70 deletions
|
@ -14,7 +14,7 @@ import (
|
|||
"code.gitea.io/gitea/routers/api/v1/utils"
|
||||
"code.gitea.io/gitea/services/context"
|
||||
"code.gitea.io/gitea/services/convert"
|
||||
files_service "code.gitea.io/gitea/services/repository/files"
|
||||
commitstatus_service "code.gitea.io/gitea/services/repository/commitstatus"
|
||||
)
|
||||
|
||||
// NewCommitStatus creates a new CommitStatus
|
||||
|
@ -64,7 +64,7 @@ func NewCommitStatus(ctx *context.APIContext) {
|
|||
Description: form.Description,
|
||||
Context: form.Context,
|
||||
}
|
||||
if err := files_service.CreateCommitStatus(ctx, ctx.Repo.Repository, ctx.Doer, sha, status); err != nil {
|
||||
if err := commitstatus_service.CreateCommitStatus(ctx, ctx.Repo.Repository, ctx.Doer, sha, status); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "CreateCommitStatus", err)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue