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
7017fb41
Commit
7017fb41
authored
Dec 05, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove GeoNode#filtered_project_registries
parent
a8f67b5f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
14 deletions
+36
-14
app/models/geo_node.rb
app/models/geo_node.rb
+0
-11
ee/app/finders/geo/project_registry_finder.rb
ee/app/finders/geo/project_registry_finder.rb
+34
-2
lib/api/geo_nodes.rb
lib/api/geo_nodes.rb
+2
-1
No files found.
app/models/geo_node.rb
View file @
7017fb41
...
...
@@ -145,17 +145,6 @@ class GeoNode < ActiveRecord::Base
projects
.
where
(
id:
project_id
).
exists?
end
def
filtered_project_registries
(
type
=
nil
)
case
type
when
'repository'
project_registries
.
failed_repos
when
'wiki'
project_registries
.
failed_wikis
else
project_registries
.
failed
end
end
def
selective_sync?
namespaces
.
exists?
end
...
...
ee/app/finders/geo/project_registry_finder.rb
View file @
7017fb41
...
...
@@ -22,6 +22,17 @@ module Geo
relation
.
count
end
def
find_failed_project_registries
(
type
=
nil
)
relation
=
if
selective_sync?
legacy_find_failed_project_registries
(
type
)
else
find_failed_projects_registries
(
type
)
end
relation
end
def
find_unsynced_projects
(
batch_size
:)
relation
=
if
fdw?
...
...
@@ -50,8 +61,15 @@ module Geo
Geo
::
ProjectRegistry
.
synced
end
def
find_failed_projects_registries
Geo
::
ProjectRegistry
.
failed
def
find_failed_projects_registries
(
type
=
nil
)
case
type
when
'repository'
Geo
::
ProjectRegistry
.
failed_repos
when
'wiki'
Geo
::
ProjectRegistry
.
failed_wikis
else
Geo
::
ProjectRegistry
.
failed
end
end
#
...
...
@@ -121,5 +139,19 @@ module Geo
joined_relation
end
def
legacy_find_failed_project_registries
(
type
)
project_registries
=
find_failed_projects_registries
(
type
)
return
Geo
::
ProjectRegistry
.
none
if
project_registries
.
empty?
joined_relation
=
project_registries
.
joins
(
<<~
SQL
)
INNER JOIN
(VALUES
#{
current_node
.
projects
.
pluck
(
:id
).
map
{
|
id
|
"(
#{
id
}
)"
}
.join(',')})
projects(project_id)
ON
#{
Geo
::
ProjectRegistry
.
table_name
}
.id = projects.project_id
SQL
joined_relation
end
end
end
lib/api/geo_nodes.rb
View file @
7017fb41
...
...
@@ -49,7 +49,8 @@ module API
not_found
(
'Geo node not found'
)
unless
geo_node
project_registries
=
paginate
(
geo_node
.
filtered_project_registries
(
params
[
:type
]))
finder
=
::
Geo
::
ProjectRegistryFinder
.
new
(
current_node:
geo_node
)
project_registries
=
paginate
(
finder
.
find_failed_project_registries
(
params
[
:type
]))
present
project_registries
,
with:
::
GeoProjectRegistryEntity
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