1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Add cache for branch divergence on branch list page (#29577)

The branch page for blender project will take 6s because calculating
divergence is very slow.
This PR will add a cache for the branch divergence calculation. So when
the second visit the branch list, it will take only less 200ms.
This commit is contained in:
Lunny Xiao
2024-03-08 18:21:24 +08:00
committed by GitHub
parent f219ea8d0e
commit 930bae2300
2 changed files with 54 additions and 6 deletions

View File

@@ -220,6 +220,11 @@ func pushUpdates(optsList []*repo_module.PushUpdateOptions) error {
}
}
// delete cache for divergence
if err := DelDivergenceFromCache(repo.ID, branch); err != nil {
log.Error("DelDivergenceFromCache: %v", err)
}
commits := repo_module.GitToPushCommits(l)
commits.HeadCommit = repo_module.CommitToPushCommit(newCommit)