forked from forgejo/forgejo
Performance improvements for pull request list page (#29900)
This PR will avoid load pullrequest.Issue twice in pull request list page. It will reduce x times database queries for those WIP pull requests. Partially fix #29585 --------- Co-authored-by: Giteabot <teabot@gitea.io> (cherry picked from commit 62f8174aa2fae1481c7e17a6afcb731a5b178cd0) Conflicts: models/activities/notification_list.go moved to models/activities/notification.go
This commit is contained in:
parent
0f4614004e
commit
d92c2048b3
14 changed files with 86 additions and 50 deletions
|
@ -240,18 +240,12 @@ func ListPinnedPullRequests(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
apiPrs := make([]*api.PullRequest, len(issues))
|
||||
if err := issues.LoadPullRequests(ctx); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "LoadPullRequests", err)
|
||||
return
|
||||
}
|
||||
for i, currentIssue := range issues {
|
||||
pr, err := currentIssue.GetPullRequest(ctx)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "GetPullRequest", err)
|
||||
return
|
||||
}
|
||||
|
||||
if err = pr.LoadIssue(ctx); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "LoadIssue", err)
|
||||
return
|
||||
}
|
||||
|
||||
pr := currentIssue.PullRequest
|
||||
if err = pr.LoadAttributes(ctx); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue