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
cc72d954
Commit
cc72d954
authored
Dec 06, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move counts on GeoNodeStatus to finders
parent
b7ef0a91
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
17 deletions
+41
-17
app/models/geo_node.rb
app/models/geo_node.rb
+0
-11
app/models/geo_node_status.rb
app/models/geo_node_status.rb
+5
-5
ee/app/finders/geo/attachment_registry_finder.rb
ee/app/finders/geo/attachment_registry_finder.rb
+12
-0
ee/app/finders/geo/file_registry_finder.rb
ee/app/finders/geo/file_registry_finder.rb
+5
-1
ee/app/finders/geo/lfs_object_registry_finder.rb
ee/app/finders/geo/lfs_object_registry_finder.rb
+15
-0
ee/app/finders/geo/project_registry_finder.rb
ee/app/finders/geo/project_registry_finder.rb
+4
-0
No files found.
app/models/geo_node.rb
View file @
cc72d954
...
...
@@ -120,17 +120,6 @@ class GeoNode < ActiveRecord::Base
end
end
def
lfs_objects
relation
=
if
selective_sync?
LfsObject
.
joins
(
:projects
).
where
(
projects:
{
id:
projects
})
else
LfsObject
.
all
end
relation
.
with_files_stored_locally
end
def
projects
if
selective_sync?
Project
.
where
(
namespace_id:
Gitlab
::
GroupHierarchy
.
new
(
namespaces
).
base_and_descendants
.
select
(
:id
))
...
...
app/models/geo_node_status.rb
View file @
cc72d954
...
...
@@ -63,9 +63,9 @@ class GeoNodeStatus < ActiveRecord::Base
latest_event
=
Geo
::
EventLog
.
latest_event
self
.
last_event_id
=
latest_event
&
.
id
self
.
last_event_date
=
latest_event
&
.
created_at
self
.
repositories_count
=
geo_node
.
projects
.
count
self
.
lfs_objects_count
=
geo_node
.
lfs_objects
.
count
self
.
attachments_count
=
attachments_finder
.
uploads
.
count
self
.
repositories_count
=
projects_finder
.
count_projects
self
.
lfs_objects_count
=
lfs_objects_finder
.
count_lfs_objects
self
.
attachments_count
=
attachments_finder
.
count_attachments
self
.
last_successful_status_check_at
=
Time
.
now
if
Gitlab
::
Geo
.
secondary?
...
...
@@ -76,8 +76,8 @@ class GeoNodeStatus < ActiveRecord::Base
self
.
repositories_failed_count
=
projects_finder
.
count_failed_project_registries
self
.
lfs_objects_synced_count
=
lfs_objects_finder
.
count_synced_lfs_objects
self
.
lfs_objects_failed_count
=
lfs_objects_finder
.
count_failed_lfs_objects
self
.
attachments_synced_count
=
attachments_finder
.
find_synced_attachments
.
count
self
.
attachments_failed_count
=
attachments_finder
.
find_failed_attachments
.
count
self
.
attachments_synced_count
=
attachments_finder
.
count_synced_attachments
self
.
attachments_failed_count
=
attachments_finder
.
count_failed_attachments
end
self
...
...
ee/app/finders/geo/attachment_registry_finder.rb
View file @
cc72d954
module
Geo
class
AttachmentRegistryFinder
<
RegistryFinder
def
count_attachments
uploads
.
count
end
def
count_synced_attachments
find_synced_attachments
.
count
end
def
count_failed_attachments
find_failed_attachments
.
count
end
def
find_synced_attachments
relation
=
if
use_legacy_queries?
...
...
ee/app/finders/geo/file_registry_finder.rb
View file @
cc72d954
...
...
@@ -95,7 +95,7 @@ module Geo
registry_ids
=
legacy_pluck_registry_ids
(
file_types: :lfs
,
except_registry_ids:
except_registry_ids
)
legacy_filter_registry_ids
(
current_node
.
lfs_objects
,
lfs_objects_finder
.
lfs_objects
,
registry_ids
,
LfsObject
.
table_name
)
...
...
@@ -136,5 +136,9 @@ module Geo
def
attachments_finder
@attachments_finder
||=
AttachmentRegistryFinder
.
new
(
current_node:
current_node
)
end
def
lfs_objects_finder
@lfs_objects_finder
||=
LfsObjectRegistryFinder
.
new
(
current_node:
current_node
)
end
end
end
ee/app/finders/geo/lfs_object_registry_finder.rb
View file @
cc72d954
module
Geo
class
LfsObjectRegistryFinder
<
RegistryFinder
def
count_lfs_objects
lfs_objects
.
count
end
def
count_synced_lfs_objects
relation
=
if
selective_sync?
...
...
@@ -22,6 +26,17 @@ module Geo
relation
.
count
end
def
lfs_objects
relation
=
if
selective_sync?
LfsObject
.
joins
(
:projects
).
where
(
projects:
{
id:
current_node
.
projects
})
else
LfsObject
.
all
end
relation
.
with_files_stored_locally
end
private
def
find_synced_lfs_objects_registries
...
...
ee/app/finders/geo/project_registry_finder.rb
View file @
cc72d954
module
Geo
class
ProjectRegistryFinder
<
RegistryFinder
def
count_projects
current_node
.
projects
.
count
end
def
count_synced_project_registries
relation
=
if
selective_sync?
...
...
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