Commit 8efbf534 authored by Rémy Coutable's avatar Rémy Coutable

Get rid of a third N+1 query problem

Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 38efe1bf
......@@ -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
......
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