Commit afb60f4c authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'remove_backward_compatible_option_from_sync_worker' into 'master'

Remove backward compatibility for Geo Sync worker

See merge request gitlab-org/gitlab!16536
parents a2750882 bd6ef103
......@@ -16,6 +16,8 @@ module Geo
# rubocop: disable CodeReuse/ActiveRecord
def perform(project_id, options = {})
options.symbolize_keys!
registry = Geo::ProjectRegistry.find_or_initialize_by(project_id: project_id)
project = registry.project
......@@ -30,8 +32,6 @@ module Geo
return
end
options = extract_options(registry, options)
sync_repository(registry, options)
sync_wiki(registry, options)
end
......@@ -48,19 +48,5 @@ module Geo
Geo::WikiSyncService.new(registry.project).execute
end
def extract_options(registry, options)
options.is_a?(Hash) ? options.symbolize_keys : backward_options(registry, options)
end
# Before GitLab 11.8 we used to pass the scheduled time instead of an options hash,
# this method makes the job arguments backward compatible and
# can be removed in any version after GitLab 12.0.
def backward_options(registry, schedule_time)
{
sync_repository: registry.repository_sync_due?(schedule_time),
sync_wiki: registry.wiki_sync_due?(schedule_time)
}
end
end
end
......@@ -21,15 +21,6 @@ RSpec.describe Geo::ProjectSyncWorker do
.with(instance_of(Project)).once.and_return(wiki_sync_service)
end
context 'backward compatibility' do
it 'performs sync for the given project when time is passed' do
subject.perform(project.id, Time.now)
expect(repository_sync_service).to have_received(:execute)
expect(wiki_sync_service).to have_received(:execute)
end
end
context 'when project could not be found' do
it 'logs an error and returns' do
expect(subject).to receive(:log_error).with("Couldn't find project, skipping syncing", project_id: 999)
......
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