mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
111297422-que_jobs
This commit is contained in:
parent
764abdfd89
commit
8ed8a46046
3 changed files with 15 additions and 1 deletions
10
app/jobs/update_whois_record_job.rb
Normal file
10
app/jobs/update_whois_record_job.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class UpdateWhoisRecordJob < Que::Job
|
||||
def run(ids, type)
|
||||
ids.each do |id|
|
||||
record = WhoisRecord.find_by(id: id)
|
||||
return unless record
|
||||
|
||||
record.save
|
||||
end
|
||||
end
|
||||
end
|
|
@ -106,7 +106,7 @@ class WhoisRecord < ActiveRecord::Base
|
|||
self.json = generated_json
|
||||
self.body = generated_body
|
||||
self.name = json['name']
|
||||
self.registrar_id = domain.registrar_id # for faster registrar updates
|
||||
self.registrar_id = domain.registrar_id if domain # for faster registrar updates
|
||||
end
|
||||
|
||||
def update_whois_server
|
||||
|
|
|
@ -12,6 +12,10 @@ namespace :whois do
|
|||
puts(@i += 10000)
|
||||
GC.start
|
||||
end
|
||||
|
||||
GC.start
|
||||
UpdateWhoisRecordJob.enqueue WhoisRecord.find_each.map(&:id), 'domain'
|
||||
|
||||
end
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue