Commit 976adcf5 authored by Nick Thomas's avatar Nick Thomas

Fix merge conflicts for Banzai::Renderer

parent bf466b33
......@@ -157,13 +157,9 @@ module Banzai
Rails.cache.send(:expanded_key, full_cache_key(cache_key, pipeline_name))
end
def update_object(object, html_field, html)
object.update_column(html_field, html) unless Gitlab::Geo.secondary?
end
# GitLab EE needs to disable updates on GET requests in Geo
def self.update_object?(object)
true
!Gitlab::Geo.secondary?
end
end
end
......@@ -14,22 +14,6 @@ describe Banzai::Renderer do
let(:renderer) { Banzai::Renderer }
subject { renderer.render_field(object, :field) }
context "with an empty cache" do
let(:object) { fake_object(:markdown) }
it "caches and returns the result" do
expect_render
expect_cache_update
expect(subject).to eq(:html)
end
it "skips database caching on a Geo secondary" do
allow(Gitlab::Geo).to receive(:secondary?).and_return(true)
expect_render
expect_cache_update.never
expect(subject).to eq(:html)
end
end
context 'with a stale cache' do
let(:object) { fake_object(fresh: false) }
......@@ -38,6 +22,13 @@ describe Banzai::Renderer do
is_expected.to eq('field_html')
end
it "skips database caching on a Geo secondary" do
allow(Gitlab::Geo).to receive(:secondary?).and_return(true)
expect(object).to receive(:refresh_markdown_cache!).with(do_update: false)
is_expected.to eq('field_html')
end
end
context 'with an up-to-date cache' 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