Expire content cache when repository fetch fails

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