mirror of
https://github.com/internetee/registry.git
synced 2025-07-04 18:23:35 +02:00
Story #109699502 - ensure log string reported if error occurs, wrap w/begin reformat white, move trailing condition
This commit is contained in:
parent
54a810524f
commit
1d8dcd923a
1 changed files with 13 additions and 12 deletions
|
@ -285,20 +285,21 @@ class Domain < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_delete_period
|
def start_delete_period
|
||||||
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
|
begin
|
||||||
|
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
|
||||||
|
|
||||||
d = Domain.where('delete_at <= ?', Time.zone.now)
|
d = Domain.where('delete_at <= ?', Time.zone.now)
|
||||||
marked = 0
|
marked = 0
|
||||||
d.each do |domain|
|
d.each do |domain|
|
||||||
next unless domain.delete_candidateable?
|
next unless domain.delete_candidateable?
|
||||||
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
STDOUT << "#{Time.zone.now.utc} Domain.start_delete_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} Domain.start_delete_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
|
||||||
domain.save
|
domain.save
|
||||||
marked += 1
|
marked += 1
|
||||||
|
end
|
||||||
|
ensure # the operator should see what was accomplished
|
||||||
|
STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{d.count} successfully set\n" unless Rails.env.test?
|
||||||
end
|
end
|
||||||
|
|
||||||
return if Rails.env.test?
|
|
||||||
STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{d.count} successfully set\n"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# rubocop:disable Rails/FindEach
|
# rubocop:disable Rails/FindEach
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue