Move jobs from Que to ActiveJob

This commit is contained in:
Alex Sherman 2020-10-19 16:01:20 +05:00
parent 1d3be40e14
commit 313731232e
53 changed files with 390 additions and 157 deletions

View file

@ -4,7 +4,7 @@ namespace :verify_email do
verifications_by_domain = EmailAddressVerification.not_verified_recently.group_by(&:domain)
verifications_by_domain.each do |_domain, verifications|
ver = verifications.sample # Verify random email to not to clog the SMTP servers
VerifyEmailsJob.enqueue(ver.id)
VerifyEmailsJob.perform_later(ver.id)
next
end
end
@ -18,6 +18,6 @@ namespace :verify_email do
verifications_by_domain = EmailAddressVerification.not_verified_recently
.by_domain(args[:domain_name])
verifications_by_domain.map { |ver| VerifyEmailsJob.enqueue(ver.id) }
verifications_by_domain.map { |ver| VerifyEmailsJob.perform_later(ver.id) }
end
end

View file

@ -23,22 +23,23 @@ namespace :whois do
print "\n-----> Update domains whois_records"
Domain.find_in_batches.each do |group|
UpdateWhoisRecordJob.enqueue group.map(&:name), 'domain'
UpdateWhoisRecordJob.perform_later group.map(&:name), 'domain'
end
print "\n-----> Update blocked domains whois_records"
BlockedDomain.find_in_batches.each do |group|
UpdateWhoisRecordJob.enqueue group.map(&:name), 'blocked'
UpdateWhoisRecordJob.perform_later group.map(&:name), 'blocked'
end
print "\n-----> Update reserved domains whois_records"
ReservedDomain.find_in_batches.each do |group|
UpdateWhoisRecordJob.enqueue group.map(&:name), 'reserved'
UpdateWhoisRecordJob.perform_later group.map(&:name), 'reserved'
end
print "\n-----> Update disputed domains whois_records"
Dispute.active.find_in_batches.each do |group|
UpdateWhoisRecordJob.enqueue group.map(&:domain_name), 'disputed'
UpdateWhoisRecordJob.perform_later group.map(&:domain_name), 'disputed'
end
end
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"