updated time of response from truemail

This commit is contained in:
olegphenomenon 2021-11-30 16:15:10 +02:00
parent 28c58826e0
commit 1ec79afb11
7 changed files with 16 additions and 9 deletions

View file

@ -5,7 +5,7 @@ module Actions
def initialize(email:, validation_eventable:, check_level: nil)
@email = email
@validation_eventable = validation_eventable
@check_level = check_level || :regex
@check_level = check_level || :mx
end
def call

View file

@ -1,7 +1,7 @@
class VerifyEmailsJob < ApplicationJob
discard_on StandardError
def perform(contact:, check_level: 'regex')
def perform(contact:, check_level: 'mx')
contact_not_found(contact.id) unless contact
validate_check_level(check_level)
action = Actions::EmailCheck.new(email: contact.email,

View file

@ -181,7 +181,9 @@ tara_rant_identifier: 'identifier'
tara_rant_secret: 'secret'
tara_rant_redirect_uri: 'redirect_uri'
default_email_validation_type: 'regex'
default_email_validation_type: 'mx'
default_connection_timeout: '1'
default_response_timeout: '1'
epp_sessions_per_registrar: '4'

View file

@ -15,15 +15,16 @@ Truemail.configure do |config|
# config.smtp_error_body_pattern = /regex_pattern/
# Optional parameter. Connection timeout is equal to 2 ms by default.
# config.connection_timeout = 1
config.connection_timeout = ENV['default_connection_timeout'].to_i
# Optional parameter. A SMTP server response timeout is equal to 2 ms by default.
# config.response_timeout = 1
config.response_timeout = ENV['default_response_timeout'].to_i
# Optional parameter. Total of connection attempts. It is equal to 2 by default.
# This parameter uses in mx lookup timeout error and smtp request (for cases when
# there is one mx server).
config.connection_attempts = 3
config.connection_attempts = 5
config.not_rfc_mx_lookup_flow = true
# Optional parameter. You can predefine default validation type for
# Truemail.validate('email@email.com') call without with-parameter
@ -34,9 +35,12 @@ Truemail.configure do |config|
elsif Rails.env.production?
config.default_validation_type = :mx
else
config.default_validation_type = :regex
config.default_validation_type = :mx
end
# config.dns = %w[195.43.87.126 195.43.87.158]
config.dns = ENV['dnssec_resolver_ips'].to_s.strip.split(', ').freeze
# Optional parameter. You can predefine which type of validation will be used for domains.
# Also you can skip validation by domain. Available validation types: :regex, :mx, :smtp
# This configuration will be used over current or default validation type parameter

View file

@ -34,6 +34,7 @@ common: &default_settings
development:
<<: *default_settings
app_name: Registry (Development)
monitor_mode: false
test:
<<: *default_settings

View file

@ -11,7 +11,7 @@ namespace :verify_email do
SPAM_PROTECT_TIMEOUT = 30.seconds
options = {
domain_name: nil,
check_level: 'regex',
check_level: 'mx',
spam_protect: false,
}
banner = 'Usage: rake verify_email:check_all -- [options]'

View file

@ -112,7 +112,7 @@ class VerifyEmailTaskTest < ActiveJob::TestCase
assert_not contact.domains.last.force_delete_scheduled?
2.times do
3.times do
run_task
end