Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
ee60ec8d
Commit
ee60ec8d
authored
Nov 02, 2016
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable DB writes if node is a GitLab Geo secondary instance
Closes #1185
parent
88b03a4c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
1 deletion
+10
-1
app/workers/prune_old_events_worker.rb
app/workers/prune_old_events_worker.rb
+2
-0
lib/banzai/renderer.rb
lib/banzai/renderer.rb
+1
-1
spec/lib/banzai/renderer_spec.rb
spec/lib/banzai/renderer_spec.rb
+7
-0
No files found.
app/workers/prune_old_events_worker.rb
View file @
ee60ec8d
...
...
@@ -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.
...
...
lib/banzai/renderer.rb
View file @
ee60ec8d
...
...
@@ -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
spec/lib/banzai/renderer_spec.rb
View file @
ee60ec8d
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment