Commit aeb6e672 authored by Oswaldo Ferreira's avatar Oswaldo Ferreira
Browse files

Reload MRs memoization after diffs creation

parent 456b31523866
...@@ -90,6 +90,10 @@ def reload_merge_requests ...@@ -90,6 +90,10 @@ def reload_merge_requests
merge_request.mark_as_unchecked merge_request.mark_as_unchecked
UpdateHeadPipelineForMergeRequestWorker.perform_async( UpdateHeadPipelineForMergeRequestWorker.perform_async(
end end
# Upcoming method calls need the refreshed version of
# @source_merge_requests diffs (for MergeRequest#commit_shas for instance).
merge_requests_for_source_branch(reload: true)
end end
def reset_merge_when_pipeline_succeeds def reset_merge_when_pipeline_succeeds
...@@ -195,7 +199,8 @@ def filter_merge_requests(merge_requests) ...@@ -195,7 +199,8 @@ def filter_merge_requests(merge_requests)
end end
def merge_requests_for_source_branch def merge_requests_for_source_branch(reload: false)
@source_merge_requests = nil if reload
@source_merge_requests ||= merge_requests_for(@branch_name) @source_merge_requests ||= merge_requests_for(@branch_name)
end end
title: Reload MRs memoization after diffs creation
type: fixed
...@@ -74,6 +74,14 @@ ...@@ -74,6 +74,14 @@
expect(@fork_build_failed_todo).to be_done expect(@fork_build_failed_todo).to be_done
end end
it 'reloads source branch MRs memoization' do
refresh_service.execute(@oldrev, @newrev, 'refs/heads/master')
expect { refresh_service.execute(@oldrev, @newrev, 'refs/heads/master') }.to change {
context 'when source branch ref does not exists' do context 'when source branch ref does not exists' do
before do before do, @user).execute(@merge_request.source_branch), @user).execute(@merge_request.source_branch)
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