mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +02:00
Merge branch '113430903-delete_candidate_randomizer' into staging
This commit is contained in:
commit
496b000592
2 changed files with 3 additions and 3 deletions
|
@ -4,6 +4,6 @@ class DomainSetDeleteCandidateJob < Que::Job
|
||||||
domain = Domain.find(domain_id)
|
domain = Domain.find(domain_id)
|
||||||
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
domain.save(validate: false)
|
domain.save(validate: false)
|
||||||
DomainDeleteJob.enqueue(domain.id, run_at: rand(24*60).minutes.from_now)
|
DomainDeleteJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -76,7 +76,7 @@ class DomainCron
|
||||||
next unless domain.delete_candidateable?
|
next unless domain.delete_candidateable?
|
||||||
real += 1
|
real += 1
|
||||||
STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} DomainCron.start_delete_period: ##{domain.id} (#{domain.name})\n" unless Rails.env.test?
|
||||||
DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(24*60).minutes.from_now) and marked += 1
|
DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now) and marked += 1
|
||||||
end
|
end
|
||||||
ensure # the operator should see what was accomplished
|
ensure # the operator should see what was accomplished
|
||||||
STDOUT << "#{Time.zone.now.utc} - Finished setting schedule for delete_candidate - #{marked} out of #{real} successfully added to Que schedule\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} - Finished setting schedule for delete_candidate - #{marked} out of #{real} successfully added to Que schedule\n" unless Rails.env.test?
|
||||||
|
@ -89,7 +89,7 @@ class DomainCron
|
||||||
|
|
||||||
c = 0
|
c = 0
|
||||||
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
|
Domain.where('force_delete_at <= ?', Time.zone.now).each do |x|
|
||||||
DomainDeleteJob.enqueue(x.id, run_at: rand(24*60).minutes.from_now)
|
DomainDeleteJob.enqueue(x.id, run_at: rand(((24*60) - (DateTime.now.hour * 60))).minutes.from_now)
|
||||||
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
STDOUT << "#{Time.zone.now.utc} DomainCron.destroy_delete_candidates: job added by force delete time ##{x.id} (#{x.name})\n" unless Rails.env.test?
|
||||||
c += 1
|
c += 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue