mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
Merge branch '113430903-delete_candidate_randomizer' into staging
This commit is contained in:
parent
a54fbe906e
commit
1cd577c72a
2 changed files with 11 additions and 4 deletions
8
app/jobs/domain_set_delete_candidate_job.rb
Normal file
8
app/jobs/domain_set_delete_candidate_job.rb
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
class DomainSetDeleteCandidateJob < Que::Job
|
||||||
|
|
||||||
|
def run(domain_id)
|
||||||
|
domain = Domain.find(domain_id)
|
||||||
|
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
||||||
|
domain.save(validate: false)
|
||||||
|
end
|
||||||
|
end
|
|
@ -75,12 +75,11 @@ class DomainCron
|
||||||
d.each do |domain|
|
d.each do |domain|
|
||||||
next unless domain.delete_candidateable?
|
next unless domain.delete_candidateable?
|
||||||
real += 1
|
real += 1
|
||||||
domain.statuses << DomainStatus::DELETE_CANDIDATE
|
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}) #{domain.changes}\n" unless Rails.env.test?
|
DomainSetDeleteCandidateJob.enqueue(domain.id, run_at: rand(24*60).minutes.from_now) 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
|
||||||
STDOUT << "#{Time.zone.now.utc} - Finished setting delete_candidate - #{marked} out of #{real} successfully set\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?
|
||||||
end
|
end
|
||||||
marked
|
marked
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue