Remove current_node from base registry finder

Refactor code to make the finder class
closer to a Geo replicator.
parent 49c9638e
...@@ -2,14 +2,6 @@ ...@@ -2,14 +2,6 @@
module Geo module Geo
class RegistryFinder class RegistryFinder
include ::Gitlab::Utils::StrongMemoize
attr_reader :current_node_id
def initialize(current_node_id: nil)
@current_node_id = current_node_id
end
# @!method find_unsynced_registries # @!method find_unsynced_registries
# Return an ActiveRecord::Relation of the registry records for the # Return an ActiveRecord::Relation of the registry records for the
# tracked ype that have never been synced. # tracked ype that have never been synced.
...@@ -77,13 +69,5 @@ module Geo ...@@ -77,13 +69,5 @@ module Geo
def failed_count def failed_count
registry_class.failed.count registry_class.failed.count
end end
private
def current_node
strong_memoize(:current_node) do
GeoNode.find(current_node_id) if current_node_id
end
end
end end
end end
...@@ -581,23 +581,23 @@ class GeoNodeStatus < ApplicationRecord ...@@ -581,23 +581,23 @@ class GeoNodeStatus < ApplicationRecord
end end
def attachments_finder def attachments_finder
@attachments_finder ||= Geo::AttachmentRegistryFinder.new(current_node_id: geo_node.id) @attachments_finder ||= Geo::AttachmentRegistryFinder.new
end end
def lfs_objects_finder def lfs_objects_finder
@lfs_objects_finder ||= Geo::LfsObjectRegistryFinder.new(current_node_id: geo_node.id) @lfs_objects_finder ||= Geo::LfsObjectRegistryFinder.new
end end
def job_artifacts_finder def job_artifacts_finder
@job_artifacts_finder ||= Geo::JobArtifactRegistryFinder.new(current_node_id: geo_node.id) @job_artifacts_finder ||= Geo::JobArtifactRegistryFinder.new
end end
def container_registry_finder def container_registry_finder
@container_registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new(current_node_id: geo_node.id) @container_registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new
end end
def design_registry_finder def design_registry_finder
@design_registry_finder ||= Geo::DesignRegistryFinder.new(current_node_id: geo_node.id) @design_registry_finder ||= Geo::DesignRegistryFinder.new
end end
def repository_verification_finder def repository_verification_finder
......
...@@ -59,7 +59,7 @@ module Geo ...@@ -59,7 +59,7 @@ module Geo
end end
def registry_finder def registry_finder
@registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new(current_node_id: current_node.id) @registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new
end end
end end
end end
...@@ -6,7 +6,7 @@ module Geo ...@@ -6,7 +6,7 @@ module Geo
EXCEPT_RESOURCE_IDS_KEY = :except_ids EXCEPT_RESOURCE_IDS_KEY = :except_ids
def registry_finder def registry_finder
@registry_finder ||= Geo::AttachmentRegistryFinder.new(current_node_id: Gitlab::Geo.current_node.id) @registry_finder ||= Geo::AttachmentRegistryFinder.new
end end
private private
......
...@@ -8,7 +8,7 @@ module Geo ...@@ -8,7 +8,7 @@ module Geo
FILE_SERVICE_OBJECT_TYPE = :job_artifact FILE_SERVICE_OBJECT_TYPE = :job_artifact
def registry_finder def registry_finder
@registry_finder ||= Geo::JobArtifactRegistryFinder.new(current_node_id: Gitlab::Geo.current_node.id) @registry_finder ||= Geo::JobArtifactRegistryFinder.new
end end
end end
end end
......
...@@ -8,7 +8,7 @@ module Geo ...@@ -8,7 +8,7 @@ module Geo
FILE_SERVICE_OBJECT_TYPE = :lfs FILE_SERVICE_OBJECT_TYPE = :lfs
def registry_finder def registry_finder
@registry_finder ||= Geo::LfsObjectRegistryFinder.new(current_node_id: Gitlab::Geo.current_node.id) @registry_finder ||= Geo::LfsObjectRegistryFinder.new
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment