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/convert | |
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/convert')
-rw-r--r-- | services/convert/notification.go | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/services/convert/notification.go b/services/convert/notification.go index 0b97530d8b..41063cf399 100644 --- a/services/convert/notification.go +++ b/services/convert/notification.go @@ -61,8 +61,9 @@ func ToNotificationThread(ctx context.Context, n *activities_model.Notification) result.Subject.LatestCommentHTMLURL = comment.HTMLURL(ctx) } - pr, _ := n.Issue.GetPullRequest(ctx) - if pr != nil && pr.HasMerged { + if err := n.Issue.LoadPullRequest(ctx); err == nil && + n.Issue.PullRequest != nil && + n.Issue.PullRequest.HasMerged { result.Subject.State = "merged" } } |