Commit 4ca16e67 authored by Michael Kozono's avatar Michael Kozono

Simplify synced scopes

parent d010f667
......@@ -12,6 +12,8 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
validates :project, presence: true, uniqueness: true
scope :dirty, -> { where(arel_table[:resync_repository].eq(true).or(arel_table[:resync_wiki].eq(true))) }
scope :synced_repos, -> { where(resync_repository: false) }
scope :synced_wikis, -> { where(resync_wiki: false) }
scope :failed_repos, -> { where(arel_table[:repository_retry_count].gt(0)) }
scope :failed_wikis, -> { where(arel_table[:wiki_retry_count].gt(0)) }
scope :verified_repos, -> { where.not(repository_verification_checksum: nil) }
......@@ -42,16 +44,6 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
)
end
def self.synced_repos
where.not(last_repository_synced_at: nil, last_repository_successful_sync_at: nil)
.where(resync_repository: false)
end
def self.synced_wikis
where.not(last_wiki_synced_at: nil, last_wiki_successful_sync_at: nil)
.where(resync_wiki: false)
end
def repository_sync_due?(scheduled_time)
never_synced_repository? || repository_sync_needed?(scheduled_time)
end
......
---
title: 'Geo: Make synced/failed scopes more consistent'
merge_request: 5171
author:
type: fixed
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