mirror of
https://github.com/internetee/registry.git
synced 2025-06-11 15:14:47 +02:00
added constant mx time check
This commit is contained in:
parent
974ff23cf4
commit
34654ecef9
2 changed files with 3 additions and 2 deletions
|
@ -9,10 +9,11 @@ class ValidationEvent < ApplicationRecord
|
||||||
VALIDATION_PERIOD = 1.year.freeze
|
VALIDATION_PERIOD = 1.year.freeze
|
||||||
VALID_CHECK_LEVELS = %w[regex mx smtp].freeze
|
VALID_CHECK_LEVELS = %w[regex mx smtp].freeze
|
||||||
VALID_EVENTS_COUNT_THRESHOLD = 5
|
VALID_EVENTS_COUNT_THRESHOLD = 5
|
||||||
|
MX_CHECK = 3
|
||||||
|
|
||||||
INVALID_EVENTS_COUNT_BY_LEVEL = {
|
INVALID_EVENTS_COUNT_BY_LEVEL = {
|
||||||
regex: 1,
|
regex: 1,
|
||||||
mx: 2,
|
mx: MX_CHECK,
|
||||||
smtp: 1,
|
smtp: 1,
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ def failed_contacts(options)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_mx_contact_validation(contact)
|
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 = data.all? { |d| d.failed? }
|
||||||
|
|
||||||
flag
|
flag
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue