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 @@
module Geo
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
# Return an ActiveRecord::Relation of the registry records for the
# tracked ype that have never been synced.
......@@ -77,13 +69,5 @@ module Geo
def failed_count
registry_class.failed.count
end
private
def current_node
strong_memoize(:current_node) do
GeoNode.find(current_node_id) if current_node_id
end
end
end
end
......@@ -581,23 +581,23 @@ class GeoNodeStatus < ApplicationRecord
end
def attachments_finder
@attachments_finder ||= Geo::AttachmentRegistryFinder.new(current_node_id: geo_node.id)
@attachments_finder ||= Geo::AttachmentRegistryFinder.new
end
def lfs_objects_finder
@lfs_objects_finder ||= Geo::LfsObjectRegistryFinder.new(current_node_id: geo_node.id)
@lfs_objects_finder ||= Geo::LfsObjectRegistryFinder.new
end
def job_artifacts_finder
@job_artifacts_finder ||= Geo::JobArtifactRegistryFinder.new(current_node_id: geo_node.id)
@job_artifacts_finder ||= Geo::JobArtifactRegistryFinder.new
end
def container_registry_finder
@container_registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new(current_node_id: geo_node.id)
@container_registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new
end
def design_registry_finder
@design_registry_finder ||= Geo::DesignRegistryFinder.new(current_node_id: geo_node.id)
@design_registry_finder ||= Geo::DesignRegistryFinder.new
end
def repository_verification_finder
......
......@@ -59,7 +59,7 @@ module Geo
end
def registry_finder
@registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new(current_node_id: current_node.id)
@registry_finder ||= Geo::ContainerRepositoryRegistryFinder.new
end
end
end
......@@ -6,7 +6,7 @@ module Geo
EXCEPT_RESOURCE_IDS_KEY = :except_ids
def registry_finder
@registry_finder ||= Geo::AttachmentRegistryFinder.new(current_node_id: Gitlab::Geo.current_node.id)
@registry_finder ||= Geo::AttachmentRegistryFinder.new
end
private
......
......@@ -8,7 +8,7 @@ module Geo
FILE_SERVICE_OBJECT_TYPE = :job_artifact
def registry_finder
@registry_finder ||= Geo::JobArtifactRegistryFinder.new(current_node_id: Gitlab::Geo.current_node.id)
@registry_finder ||= Geo::JobArtifactRegistryFinder.new
end
end
end
......
......@@ -8,7 +8,7 @@ module Geo
FILE_SERVICE_OBJECT_TYPE = :lfs
def registry_finder
@registry_finder ||= Geo::LfsObjectRegistryFinder.new(current_node_id: Gitlab::Geo.current_node.id)
@registry_finder ||= Geo::LfsObjectRegistryFinder.new
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