Commit 050178e1 authored by drew cimino's avatar drew cimino

Use StrongMemoize for Ci::Build#merge_request

parent ef4a021f
...@@ -598,13 +598,9 @@ module Ci ...@@ -598,13 +598,9 @@ module Ci
end end
def merge_request def merge_request
return @merge_request if defined?(@merge_request) strong_memoize(:merge_request) do
@merge_request ||=
begin
merge_requests = MergeRequest.includes(:latest_merge_request_diff) merge_requests = MergeRequest.includes(:latest_merge_request_diff)
.where(source_branch: ref, .where(source_branch: ref, source_project: pipeline.project)
source_project: pipeline.project)
.reorder(iid: :desc) .reorder(iid: :desc)
merge_requests.find do |merge_request| merge_requests.find do |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