Commit fb626e41 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch '197469-remove-hset_redis_diff_caching-flag' into 'master'

Remove :hset_redis_diff_caching feature flag

See merge request gitlab-org/gitlab!23507
parents d1d16612 b9d282ff
...@@ -47,11 +47,7 @@ module Gitlab ...@@ -47,11 +47,7 @@ module Gitlab
private private
def cache def cache
@cache ||= if Feature.enabled?(:hset_redis_diff_caching, project, default_enabled: true) @cache ||= Gitlab::Diff::HighlightCache.new(self)
Gitlab::Diff::HighlightCache.new(self)
else
Gitlab::Diff::DeprecatedHighlightCache.new(self)
end
end end
end end
end end
......
...@@ -38,21 +38,6 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do ...@@ -38,21 +38,6 @@ describe Gitlab::Diff::FileCollection::MergeRequestDiff do
let(:diffable) { merge_request.merge_request_diff } let(:diffable) { merge_request.merge_request_diff }
end end
context 'using Gitlab::Diff::DeprecatedHighlightCache' do
before do
stub_feature_flags(hset_redis_diff_caching: false)
end
it 'uses a different cache key if diff line keys change' do
mr_diff = described_class.new(merge_request.merge_request_diff, diff_options: nil)
key = mr_diff.cache_key
stub_const('Gitlab::Diff::Line::SERIALIZE_KEYS', [:foo])
expect(mr_diff.cache_key).not_to eq(key)
end
end
it_behaves_like 'diff statistics' do it_behaves_like 'diff statistics' do
let(:collection_default_args) do let(:collection_default_args) do
{ diff_options: {} } { diff_options: {} }
......
...@@ -33,34 +33,13 @@ describe MergeRequests::ReloadDiffsService, :use_clean_rails_memory_store_cachin ...@@ -33,34 +33,13 @@ describe MergeRequests::ReloadDiffsService, :use_clean_rails_memory_store_cachin
end end
context 'cache clearing' do context 'cache clearing' do
context 'using Gitlab::Diff::DeprecatedHighlightCache' do it 'clears the cache for older diffs on the merge request' do
before do old_diff = merge_request.merge_request_diff
stub_feature_flags(hset_redis_diff_caching: false) old_cache_key = old_diff.diffs_collection.cache_key
end
it 'clears the cache for older diffs on the merge request' do expect_any_instance_of(Redis).to receive(:del).with(old_cache_key).and_call_original
old_diff = merge_request.merge_request_diff
old_cache_key = old_diff.diffs_collection.cache_key
expect(Rails.cache).to receive(:delete).with(old_cache_key).and_call_original subject.execute
subject.execute
end
end
context 'using Gitlab::Diff::HighlightCache' do
before do
stub_feature_flags(hset_redis_diff_caching: true)
end
it 'clears the cache for older diffs on the merge request' do
old_diff = merge_request.merge_request_diff
old_cache_key = old_diff.diffs_collection.cache_key
expect_any_instance_of(Redis).to receive(:del).with(old_cache_key).and_call_original
subject.execute
end
end end
it 'avoids N+1 queries', :request_store do it 'avoids N+1 queries', :request_store do
......
...@@ -87,28 +87,10 @@ describe Notes::CreateService do ...@@ -87,28 +87,10 @@ describe Notes::CreateService do
.to receive(:unfolded_diff?) { true } .to receive(:unfolded_diff?) { true }
end end
context 'using Gitlab::Diff::DeprecatedHighlightCache' do it 'clears noteable diff cache when it was unfolded for the note position' do
before do expect_any_instance_of(Gitlab::Diff::HighlightCache).to receive(:clear)
stub_feature_flags(hset_redis_diff_caching: false)
end
it 'clears noteable diff cache when it was unfolded for the note position' do
expect_any_instance_of(Gitlab::Diff::DeprecatedHighlightCache).to receive(:clear)
described_class.new(project_with_repo, user, new_opts).execute
end
end
context 'using Gitlab::Diff::HighlightCache' do described_class.new(project_with_repo, user, new_opts).execute
before do
stub_feature_flags(hset_redis_diff_caching: true)
end
it 'clears noteable diff cache when it was unfolded for the note position' do
expect_any_instance_of(Gitlab::Diff::HighlightCache).to receive(:clear)
described_class.new(project_with_repo, user, new_opts).execute
end
end end
it 'does not clear cache when note is not the first of the discussion' do it 'does not clear cache when note is not the first of the discussion' do
......
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