Merge pull request #39 from internetee/109818648-whois_delete

109818648 whois delete
This commit is contained in:
Timo Võhmar 2015-12-17 17:09:28 +02:00
commit f54587d9c5
2 changed files with 4 additions and 4 deletions

View file

@ -308,7 +308,7 @@ class Domain < ActiveRecord::Base
c = 0
Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x|
Whois::Record.where('domain_id = ?', x.id).try(':destroy')
WhoisRecord.where(domain_id: x.id).destroy_all
destroy_with_message x
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by deleteCandidate ##{x.id} (#{x.name})\n" unless Rails.env.test?
@ -316,7 +316,7 @@ class Domain < ActiveRecord::Base
end
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
Whois::Record.where('domain_id = ?', x.id).try(':destroy')
WhoisRecord.where(domain_id: x.id).destroy_all
destroy_with_message x
STDOUT << "#{Time.zone.now.utc} Domain.destroy_delete_candidates: by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
c += 1

View file

@ -44,7 +44,7 @@ class WhoisRecord < ActiveRecord::Base
h[:changed] = domain.updated_at.try(:to_s, :iso8601)
h[:expire] = domain.valid_to.try(:to_date).try(:to_s)
h[:outzone] = domain.outzone_at.try(:to_date).try(:to_s)
h[:delete] = domain.delete_at.try(:to_date).try(:to_s)
h[:delete] = [domain.delete_at, domain.force_delete_at].compact.min.try(:to_date).try(:to_s)
h[:registrant] = domain.registrant.name
@ -113,6 +113,6 @@ class WhoisRecord < ActiveRecord::Base
end
def destroy_whois_record
Whois::Record.where(name: name).delete_all()
Whois::Record.where(name: name).delete_all
end
end