Rename Geo::RepositoryBackfilService to Geo::RepositorySyncService

parent 375f3438
module Geo module Geo
class RepositoryBackfillService class RepositorySyncService
attr_reader :project_id attr_reader :project_id
LEASE_TIMEOUT = 8.hours.freeze LEASE_TIMEOUT = 8.hours.freeze
LEASE_KEY_PREFIX = 'repository_backfill_service'.freeze LEASE_KEY_PREFIX = 'repository_sync_service'.freeze
def initialize(project_id) def initialize(project_id)
@project_id = project_id @project_id = project_id
...@@ -81,7 +81,7 @@ module Geo ...@@ -81,7 +81,7 @@ module Geo
end end
def update_registry(started_at, finished_at) def update_registry(started_at, finished_at)
log('Updating registry information') log('Updating repository sync information')
registry = Geo::ProjectRegistry.find_or_initialize_by(project_id: project_id) registry = Geo::ProjectRegistry.find_or_initialize_by(project_id: project_id)
registry.last_repository_synced_at = started_at registry.last_repository_synced_at = started_at
registry.last_repository_successful_sync_at = finished_at if finished_at registry.last_repository_successful_sync_at = finished_at if finished_at
......
require 'spec_helper' require 'spec_helper'
describe Geo::RepositoryBackfillService, services: true do describe Geo::RepositorySyncService, services: true do
let!(:primary) { create(:geo_node, :primary, host: 'primary-geo-node') } let!(:primary) { create(:geo_node, :primary, host: 'primary-geo-node') }
subject { described_class.new(project.id) } subject { described_class.new(project.id) }
...@@ -106,7 +106,7 @@ describe Geo::RepositoryBackfillService, services: true do ...@@ -106,7 +106,7 @@ describe Geo::RepositoryBackfillService, services: true do
end end
end end
context 'when repository was backfilled successfully' do context 'when repository was synced successfully' do
let(:project) { create(:project) } let(:project) { create(:project) }
let(:last_repository_synced_at) { 5.days.ago } let(:last_repository_synced_at) { 5.days.ago }
...@@ -159,7 +159,7 @@ describe Geo::RepositoryBackfillService, services: true do ...@@ -159,7 +159,7 @@ describe Geo::RepositoryBackfillService, services: true do
end end
end end
context 'when last attempt to backfill the repository failed' do context 'when last attempt to sync the repository failed' do
let(:project) { create(:project) } let(:project) { create(:project) }
let!(:registry) do let!(:registry) do
......
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