forked from forgejo/forgejo
Add stat
to ToCommit
function for speed (#21337)
Calls to ToCommit are very slow due to fetching diffs, analyzing files. This patch lets us supply `stat` as false to speed fetching a commit when we don't need the diff. /v1/repo/commits has a default `stat` set as true now. Set to false to experience fetching thousands of commits per second instead of 2-5 per second.
This commit is contained in:
parent
8765f139c7
commit
fd2d5f06b0
5 changed files with 49 additions and 31 deletions
|
@ -1306,7 +1306,7 @@ func GetPullRequestCommits(ctx *context.APIContext) {
|
|||
|
||||
apiCommits := make([]*api.Commit, 0, end-start)
|
||||
for i := start; i < end; i++ {
|
||||
apiCommit, err := convert.ToCommit(ctx.Repo.Repository, baseGitRepo, commits[i], userCache)
|
||||
apiCommit, err := convert.ToCommit(ctx.Repo.Repository, baseGitRepo, commits[i], userCache, true)
|
||||
if err != nil {
|
||||
ctx.ServerError("toCommit", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue