summaryrefslogtreecommitdiff
path: root/lib/banzai
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-27 13:58:47 +0200
committerRémy Coutable <remy@rymai.me>2017-03-28 10:52:14 +0200
commit8efbf534a23156d9253e28fa73842dd23c753d6f (patch)
tree8f212220b79cd2d0c905b8cfea0868279cceef8c /lib/banzai
parent38efe1bf9f8758a06cfc1358cc1fae768ac0943e (diff)
downloadgitlab-ce-8efbf534a23156d9253e28fa73842dd23c753d6f.tar.gz
Get rid of a third N+1 query problem
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/banzai')
-rw-r--r--lib/banzai/filter/merge_request_reference_filter.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/banzai/filter/merge_request_reference_filter.rb b/lib/banzai/filter/merge_request_reference_filter.rb
index faeace82ed2..3888acf935e 100644
--- a/lib/banzai/filter/merge_request_reference_filter.rb
+++ b/lib/banzai/filter/merge_request_reference_filter.rb
@@ -33,7 +33,9 @@ module Banzai
projects_per_reference.each do |path, project|
merge_request_ids = references_per_project[path]
- merge_requests = project.merge_requests.where(iid: merge_request_ids.to_a)
+ merge_requests = project.merge_requests
+ .where(iid: merge_request_ids.to_a)
+ .includes(target_project: :namespace)
merge_requests.each do |merge_request|
hash[project][merge_request.iid.to_i] = merge_request