Commit da969f7d authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'strong-memoize-build-merge-request' into 'master'

Use StrongMemoize for Ci::Build#merge_request

See merge request gitlab-org/gitlab!27577
parents 19769be8 050178e1
......@@ -598,13 +598,9 @@ module Ci
end
def merge_request
return @merge_request if defined?(@merge_request)
@merge_request ||=
begin
strong_memoize(:merge_request) do
merge_requests = MergeRequest.includes(:latest_merge_request_diff)
.where(source_branch: ref,
source_project: pipeline.project)
.where(source_branch: ref, source_project: pipeline.project)
.reorder(iid: :desc)
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