115693873-log_update_for_cron

This commit is contained in:
Stas 2016-03-29 15:45:19 +03:00
parent abad5accf8
commit 1882af7282
3 changed files with 8 additions and 0 deletions

View file

@ -13,6 +13,7 @@ class DomainDeleteConfirmJob < Que::Job
domain.poll_message!(:poll_pending_delete_rejected_by_registrant) domain.poll_message!(:poll_pending_delete_rejected_by_registrant)
domain.cancel_pending_delete domain.cancel_pending_delete
end end
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction
end end
end end

View file

@ -14,6 +14,7 @@ class DomainUpdateConfirmJob < Que::Job
domain.poll_message!(:poll_pending_update_rejected_by_registrant) domain.poll_message!(:poll_pending_update_rejected_by_registrant)
domain.clean_pendings_lowlevel domain.clean_pendings_lowlevel
end end
::PaperTrail.whodunnit = "job - #{self.class.name} - #{action}"
destroy # it's best to destroy the job in the same transaction destroy # it's best to destroy the job in the same transaction
end end
end end

View file

@ -25,6 +25,7 @@ class DomainCron
STDOUT << "#{Time.zone.now.utc} DomainCron.clean_expired_pendings: ##{domain.id} (#{domain.name})\n" STDOUT << "#{Time.zone.now.utc} DomainCron.clean_expired_pendings: ##{domain.id} (#{domain.name})\n"
end end
UpdateWhoisRecordJob.enqueue domain.name, 'domain' UpdateWhoisRecordJob.enqueue domain.name, 'domain'
::PaperTrail.whodunnit = "cron - #{__method__}"
end end
STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} - Successfully cancelled #{count} domain pendings\n" unless Rails.env.test?
count count
@ -41,6 +42,7 @@ class DomainCron
real += 1 real += 1
domain.set_graceful_expired domain.set_graceful_expired
STDOUT << "#{Time.zone.now.utc} DomainCron.start_expire_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} DomainCron.start_expire_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
::PaperTrail.whodunnit = "cron - #{__method__}"
domain.save(validate: false) and marked += 1 domain.save(validate: false) and marked += 1
end end
@ -58,6 +60,7 @@ class DomainCron
real += 1 real += 1
domain.statuses << DomainStatus::SERVER_HOLD domain.statuses << DomainStatus::SERVER_HOLD
STDOUT << "#{Time.zone.now.utc} DomainCron.start_redemption_grace_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} DomainCron.start_redemption_grace_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
::PaperTrail.whodunnit = "cron - #{__method__}"
domain.save(validate: false) and marked += 1 domain.save(validate: false) and marked += 1
end end
@ -77,6 +80,7 @@ class DomainCron
real += 1 real += 1
domain.statuses << DomainStatus::DELETE_CANDIDATE domain.statuses << DomainStatus::DELETE_CANDIDATE
STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name}) #{domain.changes}\n" unless Rails.env.test?
::PaperTrail.whodunnit = "cron - #{__method__}"
domain.save(validate: false) and marked += 1 domain.save(validate: false) and marked += 1
end end
ensure # the operator should see what was accomplished ensure # the operator should see what was accomplished
@ -90,6 +94,7 @@ class DomainCron
c = 0 c = 0
Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x| Domain.where("statuses @> '{deleteCandidate}'::varchar[]").each do |x|
::PaperTrail.whodunnit = "cron - #{__method__} case statuses"
WhoisRecord.where(domain_id: x.id).destroy_all WhoisRecord.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?
@ -98,6 +103,7 @@ class DomainCron
end end
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x| Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
::PaperTrail.whodunnit = "cron - #{__method__} case force_deleted_at"
WhoisRecord.where(domain_id: x.id).destroy_all WhoisRecord.where(domain_id: x.id).destroy_all
destroy_with_message x destroy_with_message x
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test? STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?