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
7bd93b5f
Commit
7bd93b5f
authored
Feb 20, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't cache has external wiki on secondaries nodes
parent
913093ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
app/models/project.rb
app/models/project.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+29
-0
No files found.
app/models/project.rb
View file @
7bd93b5f
...
...
@@ -812,7 +812,7 @@ class Project < ActiveRecord::Base
end
def
cache_has_external_wiki
update_column
(
:has_external_wiki
,
services
.
external_wikis
.
any?
)
update_column
(
:has_external_wiki
,
services
.
external_wikis
.
any?
)
unless
Gitlab
::
Geo
.
secondary?
end
def
find_or_initialize_services
...
...
spec/models/project_spec.rb
View file @
7bd93b5f
...
...
@@ -738,6 +738,35 @@ describe Project, models: true do
end
.
not_to
change
{
project
.
has_external_issue_tracker
}
end
end
describe
'#cache_has_external_wiki'
do
let
(
:project
)
{
create
(
:empty_project
,
has_external_wiki:
nil
)
}
it
'stores true if there is any external_wikis'
do
services
=
double
(
:service
,
external_wikis:
[
ExternalWikiService
.
new
])
expect
(
project
).
to
receive
(
:services
).
and_return
(
services
)
expect
do
project
.
cache_has_external_wiki
end
.
to
change
{
project
.
has_external_wiki
}.
to
(
true
)
end
it
'stores false if there is no external_wikis'
do
services
=
double
(
:service
,
external_wikis:
[])
expect
(
project
).
to
receive
(
:services
).
and_return
(
services
)
expect
do
project
.
cache_has_external_wiki
end
.
to
change
{
project
.
has_external_wiki
}.
to
(
false
)
end
it
'does not cache data when in a secondary gitlab geo node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:secondary?
)
{
true
}
expect
do
project
.
cache_has_external_wiki
end
.
not_to
change
{
project
.
has_external_wiki
}
end
end
describe
'#has_wiki?'
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