mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-07 08:32:16 +00:00
fix: git cache (#38763)
1. always use "last commit cache" 2. correctly build the cache key for any input (SafeCacheKey) 3. fix the git note "last commit cache FIXME" and avoid OOM
This commit is contained in:
@@ -365,17 +365,6 @@ func (repo *Repository) APIURL(ctxOpt ...context.Context) string {
|
||||
return httplib.MakeAbsoluteURL(ctx, setting.AppSubURL+"/api/v1/repos/"+url.PathEscape(repo.OwnerName)+"/"+url.PathEscape(repo.Name))
|
||||
}
|
||||
|
||||
// GetCommitsCountCacheKey returns cache key used for commits count caching.
|
||||
func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string {
|
||||
var prefix string
|
||||
if isRef {
|
||||
prefix = "ref"
|
||||
} else {
|
||||
prefix = "commit"
|
||||
}
|
||||
return fmt.Sprintf("commits-count-%d-%s-%s", repo.ID, prefix, contextName)
|
||||
}
|
||||
|
||||
// LoadUnits loads repo units into repo.Units
|
||||
func (repo *Repository) LoadUnits(ctx context.Context) (err error) {
|
||||
if repo.Units != nil {
|
||||
|
||||
Reference in New Issue
Block a user