added constant mx time check

This commit is contained in:
olegphenomenon 2021-11-23 16:41:27 +02:00
parent 974ff23cf4
commit 34654ecef9
2 changed files with 3 additions and 2 deletions

View file

@ -9,10 +9,11 @@ class ValidationEvent < ApplicationRecord
VALIDATION_PERIOD = 1.year.freeze
VALID_CHECK_LEVELS = %w[regex mx smtp].freeze
VALID_EVENTS_COUNT_THRESHOLD = 5
MX_CHECK = 3
INVALID_EVENTS_COUNT_BY_LEVEL = {
regex: 1,
mx: 2,
mx: MX_CHECK,
smtp: 1,
}.freeze

View file

@ -101,7 +101,7 @@ def failed_contacts(options)
end
def check_mx_contact_validation(contact)
data = contact.validation_events.order(created_at: :asc).last(3)
data = contact.validation_events.order(created_at: :asc).last(ValidationEvent::MX_CHECK)
flag = data.all? { |d| d.failed? }
flag