From 4387867d4666a6ca5beff26dcac2f043d5ec296e Mon Sep 17 00:00:00 2001 From: Piotr Sarnacki Date: Thu, 15 Aug 2013 13:30:34 +0200 Subject: [PATCH] Update encryption task Don't encrypt Request#token and do encrytion in smaller batches. I also added sleep(10). --- lib/tasks/encyrpt_all_data.rake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/tasks/encyrpt_all_data.rake b/lib/tasks/encyrpt_all_data.rake index 02b05813..dcaf844e 100644 --- a/lib/tasks/encyrpt_all_data.rake +++ b/lib/tasks/encyrpt_all_data.rake @@ -4,7 +4,6 @@ namespace :db do Travis::Database.connect to_encrypt = { - Request => [:token], SslKey => [:private_key], Token => [:token], User => [:github_oauth_token] @@ -12,9 +11,9 @@ namespace :db do encrypted_column = Travis::Model::EncryptedColumn.new to_encrypt.each do |model, column_names| - model.find_in_batches(batch_size: 10000) do |records| + model.find_in_batches(batch_size: 500) do |records| ActiveRecord::Base.transaction do - puts "Encrypted 10000 of #{model} (last_id: #{records.last.id})" + puts "Encrypted 500 of #{model} (last_id: #{records.last.id})" records.each do |record| column_names.each do |column| @@ -25,6 +24,8 @@ namespace :db do end end end + + sleep 10 end end end