Defer Last Commit Info (#16467)

One of the biggest reasons for slow repository browsing is that we wait
until last commit information has been generated for all files in the
repository.

This PR proposes deferring this generation to a new POST endpoint that
does the look up outside of the main page request.

Signed-off-by: Andrew Thornton <art27@cantab.net>
This commit is contained in:
zeripath authored and GitHub committed 2021-10-08 15:08:22 +02:00
1 parent 88fa9f3fb1
commit 001dbf100d
13 files changed
+321 -151

No files matched your search

+2 -6
View File
@@ -9,7 +9,6 @@ package git
import (
"context"
"path"
"code.gitea.io/gitea/modules/log"
@@ -93,15 +92,12 @@ func (c *LastCommitCache) recursiveCache(ctx context.Context, index cgobject.Com
entryMap[entry.Name()] = entry
}
commits, err := GetLastCommitForPaths(ctx, index, treePath, entryPaths)
commits, err := GetLastCommitForPaths(ctx, c, index, treePath, entryPaths)
if err != nil {
return err
}
for entry, cm := range commits {
if err := c.Put(index.ID().String(), path.Join(treePath, entry), cm.ID().String()); err != nil {
return err
}
for entry := range commits {
if entryMap[entry].IsDir() {
subTree, err := tree.SubTree(entry)
if err != nil {