Fix undefined method pending_delete for nil class

parent aa78453c
......@@ -18,7 +18,7 @@ module Geo
return unless Gitlab::Geo.secondary?
@registry = Geo::ProjectRegistry.find_by_id(registry_id)
return if registry.nil? || project.pending_delete?
return if registry.nil? || project.nil? || project.pending_delete?
try_obtain_lease do
verify_checksum(:repository)
......
......@@ -36,6 +36,12 @@ describe Geo::RepositoryVerification::Secondary::SingleWorker, :postgresql, :cle
expect { subject.perform(-1) }.not_to raise_error
end
it 'does not raise an error when project could not be found' do
registry.update_column(:project_id, -1)
expect { subject.perform(registry.id) }.not_to raise_error
end
it 'runs verification for both repository and wiki' do
create(:repository_state, project: project, repository_verification_checksum: 'my_checksum', wiki_verification_checksum: 'my_checksum')
......
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