Skip to content
Snippets Groups Projects
Commit 88e88a80 authored by Yorick Peterse's avatar Yorick Peterse
Browse files

Merge branch 'sh-disable-geo-secondary-writes' into 'master'

Disable DB writes if node is a GitLab Geo secondary instance

See merge request !834
parents 66917e3e ee60ec8d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,6 +3,8 @@ class PruneOldEventsWorker
include CronjobQueue
 
def perform
return if Gitlab::Geo.secondary?
# Contribution calendar shows maximum 12 months of events.
# Double nested query is used because MySQL doesn't allow DELETE subqueries
# on the same table.
Loading
Loading
Loading
Loading
@@ -168,7 +168,7 @@ module Banzai
end
 
def update_object(object, html_field, html)
object.update_column(html_field, html)
object.update_column(html_field, html) unless Gitlab::Geo.secondary?
end
end
end
Loading
Loading
@@ -39,6 +39,13 @@ describe Banzai::Renderer do
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 filled cache" do
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment