Handle the Gitlab::Shell::Error on Geo repository fetch worker

parent cf91b76a
class GeoRepositoryFetchWorker
include Sidekiq::Worker
include Gitlab::ShellAdapter
sidekiq_options queue: 'geo_repository_update'
def perform(project_id, clone_url)
......@@ -12,5 +13,7 @@ class GeoRepositoryFetchWorker
project.repository.expire_all_method_caches
project.repository.expire_branch_cache
project.repository.expire_content_cache
rescue Gitlab::Shell::Error => e
logger.error "Error fetching repository for project #{project.path_with_namespace}: #{e}"
end
end
......@@ -40,6 +40,12 @@ describe GeoRepositoryFetchWorker do
perform
end
it 'does not raise exception when git failures occurs' do
expect_any_instance_of(Repository).to receive(:fetch_geo_mirror).and_raise(Gitlab::Shell::Error)
expect { perform }.not_to raise_error
end
end
def perform
......
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