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

parent cf91b76a
class GeoRepositoryFetchWorker class GeoRepositoryFetchWorker
include Sidekiq::Worker include Sidekiq::Worker
include Gitlab::ShellAdapter include Gitlab::ShellAdapter
sidekiq_options queue: 'geo_repository_update' sidekiq_options queue: 'geo_repository_update'
def perform(project_id, clone_url) def perform(project_id, clone_url)
...@@ -12,5 +13,7 @@ class GeoRepositoryFetchWorker ...@@ -12,5 +13,7 @@ class GeoRepositoryFetchWorker
project.repository.expire_all_method_caches project.repository.expire_all_method_caches
project.repository.expire_branch_cache project.repository.expire_branch_cache
project.repository.expire_content_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
end end
...@@ -40,6 +40,12 @@ describe GeoRepositoryFetchWorker do ...@@ -40,6 +40,12 @@ describe GeoRepositoryFetchWorker do
perform perform
end 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 end
def perform 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