Commit f2cdab59 authored by Stan Hu's avatar Stan Hu

Merge branch '1997-geo-better-handle-git-failures' into 'master'

Resolve "Geo: Better handle SSH/git failures"

Closes #1997

See merge request !1542
parents b647aad2 cfcbe8a7
class GeoRepositoryFetchWorker class GeoRepositoryFetchWorker
include Sidekiq::Worker include Sidekiq::Worker
include ::GeoDynamicBackoff
include GeoQueue
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 +15,7 @@ class GeoRepositoryFetchWorker ...@@ -12,5 +15,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
---
title: 'Geo: handle git failures on GeoRepositoryFetchWorker'
merge_request:
author:
...@@ -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