mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
registrar updates
This commit is contained in:
parent
308666824f
commit
37b74d2086
3 changed files with 4 additions and 4 deletions
|
@ -44,9 +44,8 @@ class Registrar < ActiveRecord::Base
|
||||||
|
|
||||||
after_save :update_whois_records
|
after_save :update_whois_records
|
||||||
def update_whois_records
|
def update_whois_records
|
||||||
if changed? && (changes.keys & WHOIS_TRIGGERS).present?
|
return true unless (changed? && (changes.keys & WHOIS_TRIGGERS).present?)
|
||||||
whois_records.map(&:save) # slow currently
|
whois_records.map(&:save) # slow currently
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
class WhoisRecord < ActiveRecord::Base
|
class WhoisRecord < ActiveRecord::Base
|
||||||
belongs_to :domain
|
belongs_to :domain
|
||||||
|
belongs_to :registrar
|
||||||
|
|
||||||
validates :domain, :name, :body, :json, presence: true
|
validates :domain, :name, :body, :json, presence: true
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace :whois do
|
||||||
ActiveRecord::Base.uncached do
|
ActiveRecord::Base.uncached do
|
||||||
puts "\n#{@i}"
|
puts "\n#{@i}"
|
||||||
Domain.included.find_in_batches(batch_size: 10000) do |batch|
|
Domain.included.find_in_batches(batch_size: 10000) do |batch|
|
||||||
batch.map { |d| d.update_whois_record }
|
batch.map(&:update_whois_record)
|
||||||
puts(@i += 10000)
|
puts(@i += 10000)
|
||||||
GC.start
|
GC.start
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue