mirror of
https://github.com/internetee/registry.git
synced 2025-08-12 20:49:36 +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
|
02.04.2015
|
||||||
|
|
||||||
* Depricated DelayedJob, kill all running delayed jobs if needed
|
* Depricated DelayedJob, kill all running delayed jobs if needed
|
||||||
|
|
|
@ -1,21 +1,15 @@
|
||||||
namespace :whois do
|
namespace :whois do
|
||||||
desc 'Regenerate Registry records and sync whois database'
|
desc 'Delete whois database data and import all from Registry (fast)'
|
||||||
task sync_all: :environment do
|
task reset: :environment do
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
desc 'Regenerate whois records at Registry master database'
|
|
||||||
task generate: :environment do
|
|
||||||
start = Time.zone.now.to_f
|
start = Time.zone.now.to_f
|
||||||
print "-----> Update Registry whois records..."
|
print "-----> Reset whois database and sync..."
|
||||||
Domain.included.find_each(batch_size: 100000).with_index do |d, index|
|
domains = Domain.pluck(:name, :whois_body)
|
||||||
d.update_columns(whois_body: d.update_whois_body)
|
Whois::Domain.delete_all
|
||||||
print '.' if index % 100 == 0
|
Whois::Domain.import([:name, :whois_body], domains)
|
||||||
end
|
|
||||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Sync whois database'
|
desc 'Sync whois database without reset (slow)'
|
||||||
task sync: :environment do
|
task sync: :environment do
|
||||||
start = Time.zone.now.to_f
|
start = Time.zone.now.to_f
|
||||||
print "-----> Sync whois database..."
|
print "-----> Sync whois database..."
|
||||||
|
@ -25,4 +19,15 @@ namespace :whois do
|
||||||
end
|
end
|
||||||
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
puts "\n-----> all done in #{(Time.zone.now.to_f - start).round(2)} seconds"
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue