diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-03-21 21:13:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-21 14:13:08 +0100 |
commit | 62f8174aa2fae1481c7e17a6afcb731a5b178cd0 (patch) | |
tree | f94686ea110e943418a25534e0306f45169c9f48 /services/pull | |
parent | 01500957c29f6bfa2396b8457dbb0645edaafa99 (diff) | |
download | gitea-62f8174aa2fae1481c7e17a6afcb731a5b178cd0.tar.gz gitea-62f8174aa2fae1481c7e17a6afcb731a5b178cd0.zip |
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>
Diffstat (limited to 'services/pull')
-rw-r--r-- | services/pull/review.go | 4 |
1 files changed, 2 insertions, 2 deletions
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 |