Task remove all old validation event records

This commit is contained in:
Thiago Youssef 2022-05-18 11:08:37 +03:00
parent bbc1380e46
commit 4dcd6d765c
5 changed files with 28 additions and 53 deletions

View file

@ -20,11 +20,11 @@ namespace :verify_email do
hash: opts_hash)
email_contacts = prepare_contacts(options)
email_contacts.each do |email|
VerifyEmailsJob.set(wait_until: spam_protect_timeout(options)).perform_later(
email: email,
check_level: check_level(options)
)
VerifyEmailsJob.set(wait_until: spam_protect_timeout(options))
.perform_later(email: email, check_level: check_level(options))
end
ValidationEvent.old_records.destroy_all
end
end
@ -40,10 +40,6 @@ def spam_protect_timeout(options)
spam_protect(options) ? 0.seconds : SPAM_PROTECT_TIMEOUT
end
def logger
@logger ||= ActiveSupport::TaggedLogging.new(Syslog::Logger.new('registry'))
end
def prepare_contacts(options)
if options[:domain_name].present?
contacts_by_domain(options[:domain_name])