Expire content cache when repository fetch fails

parent 517a9f97
......@@ -75,6 +75,7 @@ module Github
true
rescue Github::RepositoryFetchError
expire_repository_cache
false
ensure
keep_track_of_errors
......@@ -88,7 +89,7 @@ module Github
project.repository.add_remote('github', repo_url)
project.repository.set_remote_as_mirror('github')
project.repository.fetch_remote('github', forced: true)
rescue Gitlab::Shell::Error => e
rescue Gitlab::Git::Repository::NoRepository, Gitlab::Shell::Error => e
error(:project, repo_url, e.message)
raise Github::RepositoryFetchError
end
......@@ -368,7 +369,7 @@ module Github
end
def expire_repository_cache
repository.expire_content_cache
repository.expire_content_cache if project.repository_exists?
end
def keep_track_of_errors
......
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