Commit f9ae015f authored by Michael Kozono's avatar Michael Kozono

Apply 7 suggestion(s) to 4 file(s)

parent 307b425f
......@@ -2,14 +2,14 @@
module Geo
class ProjectRegistryFinder
# Returns ProjectRegistry records that have never have an attempt tp sync.
# Returns ProjectRegistry records where sync has never been attempted.
#
# Does not care about selective sync, because it considers the Registry
# table to be the single source of truth. The contract is that other
# processes need to ensure that the table only contains records that should
# be synced.
#
# Any registries that have ever been synced that currently need to be
# Any registries that this secondary has ever attempted to sync that currently need to be
# resynced will be handled by other find methods (like
# #find_registries_needs_sync_again)
#
......
......@@ -4,14 +4,14 @@ module Geo
class RegistryFinder
# @!method find_registries_never_attempted_sync
# Return an ActiveRecord::Relation of the registry records for the
# tracked ype that have never have an attempt to sync.
# tracked type that this secondary has never attempted to sync.
#
# Does not care about selective sync, because it considers the Registry
# table to be the single source of truth. The contract is that other
# processes need to ensure that the table only contains records that should
# be synced.
#
# Any registries that have ever been synced that currently need to be
# Any registries that this secondary has ever attempted to sync that currently need to be
# resynced will be handled by other find methods (like
# #find_registries_needs_sync_again)
#
......
......@@ -37,7 +37,7 @@ module Geo::ReplicableRegistry
scope :failed, -> { with_state(:failed) }
scope :needs_sync_again, -> { failed.retry_due }
scope :never_attempted_sync, -> { with_state(:pending).where(last_synced_at: nil) }
scope :never_attempted_sync, -> { pending.where(last_synced_at: nil) }
scope :ordered, -> { order(:id) }
scope :pending, -> { with_state(:pending) }
scope :retry_due, -> { where(arel_table[:retry_at].eq(nil).or(arel_table[:retry_at].lt(Time.current))) }
......
......@@ -42,7 +42,7 @@ module Geo
if remaining_capacity == 0
resources
else
resources + fin_jobs_needs_sync_again(batch_size: remaining_capacity)
resources + find_jobs_needs_sync_again(batch_size: remaining_capacity)
end
end
......@@ -52,7 +52,7 @@ module Geo
.pluck_model_foreign_key
end
def fin_jobs_needs_sync_again(batch_size:)
def find_jobs_needs_sync_again(batch_size:)
registry_finder
.find_registries_needs_sync_again(batch_size: batch_size, except_ids: scheduled_repository_ids)
.pluck_model_foreign_key
......
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