Story #109699502 - ensure log string reported if error occurs, wrap w/begin reformat white, move trailing condition

This commit is contained in:
Matt Farnsworth 2015-12-08 17:03:57 +02:00
parent 54a810524f
commit 1d8dcd923a

View file

@ -285,6 +285,7 @@ class Domain < ActiveRecord::Base
end
def start_delete_period
begin
STDOUT << "#{Time.zone.now.utc} - Setting delete_candidate to domains\n" unless Rails.env.test?
d = Domain.where('delete_at <= ?', Time.zone.now)
@ -296,9 +297,9 @@ class Domain < ActiveRecord::Base
domain.save
marked += 1
end
return if Rails.env.test?
STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{d.count} successfully set\n"
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
# rubocop:disable Rails/FindEach