Commit 36f8fbf8 authored by Patrick Bajao's avatar Patrick Bajao

Disable caching of MergeToRefService call in mergeability check

Reverts https://gitlab.com/gitlab-org/gitlab/-/merge_requests/69019.

This is due to a bug wherein the cached merge to ref result becomes
stale when a commit from MR is removed.

Changelog: fixed
parent bb3a0e9c
...@@ -157,9 +157,7 @@ module MergeRequests ...@@ -157,9 +157,7 @@ module MergeRequests
def merge_to_ref def merge_to_ref
params = { allow_conflicts: Feature.enabled?(:display_merge_conflicts_in_diff, project) } params = { allow_conflicts: Feature.enabled?(:display_merge_conflicts_in_diff, project) }
result = MergeRequests::MergeToRefService result = MergeRequests::MergeToRefService.new(project: project, current_user: merge_request.author, params: params).execute(merge_request)
.new(project: project, current_user: merge_request.author, params: params)
.execute(merge_request, true)
result[:status] == :success result[:status] == :success
end end
......
...@@ -132,15 +132,6 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar ...@@ -132,15 +132,6 @@ RSpec.describe MergeRequests::MergeabilityCheckService, :clean_gitlab_redis_shar
it_behaves_like 'mergeable merge request' it_behaves_like 'mergeable merge request'
it 'calls MergeToRefService with cache parameter' do
service = instance_double(MergeRequests::MergeToRefService)
expect(MergeRequests::MergeToRefService).to receive(:new).once { service }
expect(service).to receive(:execute).once.with(merge_request, true).and_return(success: true)
described_class.new(merge_request).execute(recheck: true)
end
context 'when concurrent calls' do context 'when concurrent calls' do
it 'waits first lock and returns "cached" result in subsequent calls' do it 'waits first lock and returns "cached" result in subsequent calls' do
threads = execute_within_threads(amount: 3) threads = execute_within_threads(amount: 3)
......
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