109818648-domains_destroy_change

This commit is contained in:
Stas 2015-12-14 18:09:38 +02:00
parent 4ee7294a3f
commit c83fa049c7

View file

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