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
|
@ -268,11 +268,11 @@ func CreateCodeCommentKnownReviewID(ctx context.Context, doer *user_model.User,
|
|||
|
||||
// SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist
|
||||
func SubmitReview(ctx context.Context, doer *user_model.User, gitRepo *git.Repository, issue *issues_model.Issue, reviewType issues_model.ReviewType, content, commitID string, attachmentUUIDs []string) (*issues_model.Review, *issues_model.Comment, error) {
|
||||
pr, err := issue.GetPullRequest(ctx)
|
||||
if err != nil {
|
||||
if err := issue.LoadPullRequest(ctx); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
pr := issue.PullRequest
|
||||
var stale bool
|
||||
if reviewType != issues_model.ReviewTypeApprove && reviewType != issues_model.ReviewTypeReject {
|
||||
stale = false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue