Remove max verification attempts check

parent 53be07e0
......@@ -4,7 +4,6 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
include ::IgnorableColumn
include ::ShaAttribute
MAX_VERIFICATION_RETRIES = 5
REGISTRY_TYPES = %i{repository wiki}.freeze
RETRIES_BEFORE_REDOWNLOAD = 5
......@@ -155,10 +154,6 @@ class Geo::ProjectRegistry < Geo::BaseRegistry
retry_count(type) > RETRIES_BEFORE_REDOWNLOAD
end
def should_be_reverified?(type)
verification_retry_count(type) <= MAX_VERIFICATION_RETRIES
end
def verification_retry_count(type)
public_send("#{type}_verification_retry_count").to_i # rubocop:disable GitlabSecurity/PublicSend
end
......
......@@ -32,13 +32,6 @@ module Geo
registry.public_send("resync_#{type}") # rubocop:disable GitlabSecurity/PublicSend
end
def reverify?
# We can have stale checksums in the database, in this case, even resyncing
# the project the checksum will not match. This guard clause prevents us to
# retry the verification for the same projects over and over.
registry.should_be_reverified?(type)
end
def primary_checksum
project.repository_state.public_send("#{type}_verification_checksum") # rubocop:disable GitlabSecurity/PublicSend
end
......@@ -67,7 +60,9 @@ module Geo
reverify, verification_retry_count =
if mismatch || failure.present?
log_error(failure, exception, type: type)
[reverify?, registry.verification_retry_count(type) + 1]
[true, registry.verification_retry_count(type) + 1]
else
[false, nil]
end
resync_retry_at, resync_retry_count =
......@@ -80,7 +75,7 @@ module Geo
"#{type}_checksum_mismatch" => mismatch,
"last_#{type}_verification_failure" => failure,
"#{type}_verification_retry_count" => verification_retry_count,
"resync_#{type}" => reverify.present?,
"resync_#{type}" => reverify,
"#{type}_retry_at" => resync_retry_at,
"#{type}_retry_count" => resync_retry_count
)
......
......@@ -94,24 +94,6 @@ describe Geo::RepositoryVerificationSecondaryService, :geo do
)
end
it "does not mark #{type} to be resynced when max retry attempts reached" do
stub_const('Geo::ProjectRegistry::MAX_VERIFICATION_RETRIES', 1)
registry.update("#{type}_verification_retry_count" => 2)
service.execute
expect(registry).to have_attributes(
"#{type}_verification_checksum_sha" => nil,
"#{type}_checksum_mismatch" => true,
"last_#{type}_verification_failure" => "#{type.to_s.capitalize} checksum mismatch",
"#{type}_verification_retry_count" => 3,
"resync_#{type}" => false,
"#{type}_retry_at" => nil,
"#{type}_retry_count" => nil
)
end
it 'ensures the next retry time is capped properly' do
registry.update("#{type}_retry_count" => 30)
......
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