Commit 0a9ea81c authored by Gabriel Mazetto's avatar Gabriel Mazetto

Clear emptiness cache when NoRepository exception is detected

parent c88ae4d1
......@@ -36,8 +36,12 @@ module Geo
expire_repository_caches
finished_at = DateTime.now
rescue Gitlab::Git::Repository::NoRepository, Gitlab::Shell::Error => e
rescue Gitlab::Shell::Error => e
Rails.logger.error("#{self.class.name}: Error syncing repository for project #{project.path_with_namespace}: #{e}")
rescue Gitlab::Git::Repository::NoRepository => e
Rails.logger.error("#{self.class.name}: Error invalid repository for project #{project.path_with_namespace}: #{e}")
log('Expiring caches')
project.repository.after_create
end
[started_at, finished_at]
......
......@@ -20,8 +20,12 @@ module Geo
project.repository.expire_branch_cache
project.repository.expire_content_cache
end
rescue Gitlab::Git::Repository::NoRepository, Gitlab::Shell::Error => e
rescue Gitlab::Shell::Error => e
logger.error "#{self.class.name}: Error fetching repository for project #{project.path_with_namespace}: #{e}"
rescue Gitlab::Git::Repository::NoRepository => e
logger.error "#{self.class.name}: Error invalid repository for project #{project.path_with_namespace}: #{e}"
logger.warn "#{self.class.name}: Invalidating cache for project #{project.path_with_namespace}"
project.repository.after_create
end
private
......
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