Commit 0b4f9ff4 authored by Sean McGivern's avatar Sean McGivern

Merge branch 'sh-fix-source-project-nplus-one' into 'master'

Fix N+1 with source_projects in merge requests API

See merge request gitlab-org/gitlab-ce!19346
parents c63cd738 bd4bfcc6
---
title: Fix N+1 with source_projects in merge requests API
merge_request:
author:
type: performance
...@@ -38,7 +38,7 @@ module API ...@@ -38,7 +38,7 @@ module API
merge_requests = MergeRequestsFinder.new(current_user, args).execute merge_requests = MergeRequestsFinder.new(current_user, args).execute
.reorder(args[:order_by] => args[:sort]) .reorder(args[:order_by] => args[:sort])
merge_requests = paginate(merge_requests) merge_requests = paginate(merge_requests)
.preload(:target_project) .preload(:source_project, :target_project)
return merge_requests if args[:view] == 'simple' return merge_requests if args[:view] == 'simple'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment