Add a thin encapsulation around .pluck(:project_id)

parent 9936aa32
......@@ -70,11 +70,11 @@ module Geo
.or(legacy_repository_state_table[:wiki_verification_checksum].not_eq(nil)
.and(project_registry_sync_table[:want_to_sync_wiki].eq(true))))
.limit(batch_size)
.pluck(:project_id)
.pluck_project_key
legacy_inner_join_registry_ids(
Geo::ProjectRegistry.where(project_id: project_ids),
current_node.projects.pluck(:id),
Geo::ProjectRegistry.project_id_in(project_ids),
current_node.projects.pluck_primary_key,
Geo::ProjectRegistry,
foreign_key: :project_id
)
......
......@@ -31,6 +31,10 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
scope :wiki_checksum_mismatch, -> { where(wiki_checksum_mismatch: true) }
scope :with_routes, -> { includes(project: :route).includes(project: { namespace: :route }) }
def self.project_id_in(ids)
where(project_id: ids)
end
def self.failed
repository_sync_failed = arel_table[:repository_retry_count].gt(0)
wiki_sync_failed = arel_table[:wiki_retry_count].gt(0)
......
......@@ -18,4 +18,8 @@ class ProjectRepositoryState < ApplicationRecord
scope :verification_failed_wikis, -> { where.not(last_wiki_verification_failure: nil) }
scope :verified_repos, -> { where.not(repository_verification_checksum: nil).where(last_repository_verification_failure: nil) }
scope :verified_wikis, -> { where.not(wiki_verification_checksum: nil).where(last_wiki_verification_failure: nil) }
def self.pluck_project_key
where(nil).pluck(:project_id)
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