Commit 6d9fd6d5 authored by James Lopez's avatar James Lopez

refactor wiki service

parent f5b63600
......@@ -32,12 +32,12 @@ module Geo
Gitlab::Shell::Error,
ProjectWiki::CouldNotCreateWikiError,
Geo::EmptyCloneUrlPrefixError => e
log_error('Error syncing wiki repository', e)
registry.increment!(:wiki_retry_count)
fail_registry('Error syncing wiki repository', e)
rescue Gitlab::Git::Repository::NoRepository => e
log_error('Invalid wiki', e)
registry.update(force_to_redownload_wiki: true,
wiki_retry_count: retry_count + 1)
fail_registry('Invalid wiki', e)
log_info('Setting force_to_redownload flag')
registry.update(force_to_redownload_wiki: true,)
ensure
clean_up_temporary_repository if redownload
end
......@@ -50,6 +50,13 @@ module Geo
project.wiki.repository
end
def fail_registry(message, error)
log_error(message, error)
registry.update!(last_wiki_sync_failure: "#{message}: #{error.message}",
wiki_retry_count: retry_count + 1)
end
def retry_count
registry.public_send("#{type}_retry_count") || -1 # rubocop:disable GitlabSecurity/PublicSend
end
......
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