mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 16:02:03 +02:00
Added whois rake tasks
This commit is contained in:
parent
fbd7ca3146
commit
cff06e9286
2 changed files with 22 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
|||
15.04.2015
|
||||
|
||||
* Added whois tasks, more info with rake -T whois
|
||||
|
||||
02.04.2015
|
||||
|
||||
* Depricated DelayedJob, kill all running delayed jobs if needed
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
namespace :whois do
|
||||
desc 'Regenerate Registry records and sync whois database'
|
||||
task sync_all: :environment do
|
||||
|
||||
end
|
||||
|
||||
desc 'Regenerate whois records at Registry master database'
|
||||
task generate: :environment do
|
||||
desc 'Delete whois database data and import all from Registry (fast)'
|
||||
task reset: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
print "-----> Update Registry whois records..."
|
||||
Domain.included.find_each(batch_size: 100000).with_index do |d, index|
|
||||
d.update_columns(whois_body: d.update_whois_body)
|
||||
print '.' if index % 100 == 0
|
||||
end
|
||||
print "-----> Reset whois database and sync..."
|
||||
domains = Domain.pluck(:name, :whois_body)
|
||||
Whois::Domain.delete_all
|
||||
Whois::Domain.import([:name, :whois_body], domains)
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
|
||||
desc 'Sync whois database'
|
||||
desc 'Sync whois database without reset (slow)'
|
||||
task sync: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
print "-----> Sync whois database..."
|
||||
|
@ -25,4 +19,15 @@ namespace :whois do
|
|||
end
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
|
||||
desc 'Regenerate whois_body at Registry master database (slow)'
|
||||
task generate: :environment do
|
||||
start = Time.zone.now.to_f
|
||||
print "-----> Update Registry records..."
|
||||
Domain.included.find_each(batch_size: 100000).with_index do |d, index|
|
||||
d.update_columns(whois_body: d.update_whois_body)
|
||||
print '.' if index % 100 == 0
|
||||
end
|
||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue