mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 10:19:45 +02:00
Stroy#110392672 - Contact domains update should be async
This commit is contained in:
parent
438b22f19d
commit
678852091b
3 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ class RegenerateRegistrarWhoisesJob < Que::Job
|
||||||
registrar = Registrar.find(registrar_id)
|
registrar = Registrar.find(registrar_id)
|
||||||
|
|
||||||
registrar.whois_records.select(:id).find_in_batches(batch_size: 20) do |group|
|
registrar.whois_records.select(:id).find_in_batches(batch_size: 20) do |group|
|
||||||
RegenerateWhoisRecordJob.enqueue group.map(&:id)
|
RegenerateWhoisRecordJob.enqueue group.map(&:id), :id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -1,7 +1,7 @@
|
||||||
class RegenerateWhoisRecordJob < Que::Job
|
class RegenerateWhoisRecordJob < Que::Job
|
||||||
def run(ids)
|
def run(ids, attr = :id)
|
||||||
ids.each do |id|
|
ids.each do |id|
|
||||||
record = WhoisRecord.find_by(id: id)
|
record = WhoisRecord.find_by(attr => id)
|
||||||
return unless record
|
return unless record
|
||||||
|
|
||||||
record.save
|
record.save
|
||||||
|
|
|
@ -498,7 +498,7 @@ class Contact < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_related_whois_records
|
def update_related_whois_records
|
||||||
related_domain_descriptions.each{ |x, y| WhoisRecord.find_by(name: x).try(:save) }
|
RegenerateWhoisRecordJob.enqueue related_domain_descriptions.keys, :name
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue