From 62f8174aa2fae1481c7e17a6afcb731a5b178cd0 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 21 Mar 2024 21:13:08 +0800 Subject: 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 --- services/pull/review.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'services/pull') diff --git a/services/pull/review.go b/services/pull/review.go index 90d07c8358..8900ae2ab1 100644 --- a/services/pull/review.go +++ b/services/pull/review.go @@ -268,11 +268,11 @@ func createCodeComment(ctx context.Context, doer *user_model.User, repo *repo_mo // 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 -- cgit v1.2.3