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
a6cf8fa5
Commit
a6cf8fa5
authored
Mar 08, 2019
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize count_verified_wikis SQL
parent
fbc3f8bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
2 deletions
+27
-2
ee/app/finders/geo/repository_verification_finder.rb
ee/app/finders/geo/repository_verification_finder.rb
+1
-1
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+0
-1
ee/spec/finders/geo/repository_verification_finder_spec.rb
ee/spec/finders/geo/repository_verification_finder_spec.rb
+26
-0
No files found.
ee/app/finders/geo/repository_verification_finder.rb
View file @
a6cf8fa5
...
...
@@ -65,7 +65,7 @@ module Geo
end
def
count_verified_wikis
Project
.
verified_wikis
.
count
Project
RepositoryState
.
verified_wikis
.
count
end
def
count_verification_failed_repositories
...
...
ee/app/models/ee/project.rb
View file @
a6cf8fa5
...
...
@@ -88,7 +88,6 @@ module EE
scope
:with_wiki_enabled
,
->
{
with_feature_enabled
(
:wiki
)
}
scope
:verified_wikis
,
->
{
joins
(
:repository_state
).
merge
(
ProjectRepositoryState
.
verified_wikis
)
}
scope
:verification_failed_repos
,
->
{
joins
(
:repository_state
).
merge
(
ProjectRepositoryState
.
verification_failed_repos
)
}
scope
:verification_failed_wikis
,
->
{
joins
(
:repository_state
).
merge
(
ProjectRepositoryState
.
verification_failed_wikis
)
}
scope
:for_plan_name
,
->
(
name
)
{
joins
(
namespace: :plan
).
where
(
plans:
{
name:
name
})
}
...
...
ee/spec/finders/geo/repository_verification_finder_spec.rb
View file @
a6cf8fa5
...
...
@@ -278,4 +278,30 @@ describe Geo::RepositoryVerificationFinder, :postgresql do
end
end
end
describe
'#count_verified_wikis'
do
context
'when a wiki is verified'
do
it
'includes the wiki'
do
create
(
:repository_state
,
:wiki_verified
)
expect
(
subject
.
count_verified_wikis
).
to
eq
(
1
)
end
end
context
'when a wiki failed verification'
do
it
'excludes the wiki'
do
create
(
:repository_state
,
:wiki_failed
)
expect
(
subject
.
count_verified_wikis
).
to
eq
(
0
)
end
end
context
'when a wiki has outdated verification'
do
it
'excludes the wiki'
do
create
(
:repository_state
,
:wiki_outdated
)
expect
(
subject
.
count_verified_wikis
).
to
eq
(
0
)
end
end
end
end
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