diff --git a/lib/tasks/prune_db.rake b/lib/tasks/prune_db.rake index 58a690f..a1fac8a 100644 --- a/lib/tasks/prune_db.rake +++ b/lib/tasks/prune_db.rake @@ -5,23 +5,18 @@ namespace :prune_db do task(:invalidate_votes_with_bad_response_times => :environment) do badvotes = [] #might want to optimize later to not start from the beginning each time - Vote.find_each(:batch_size => 1000, :include => :appearance) do |v| + STDOUT.sync = true + Vote.find_each(:batch_size => 10000, :include => :appearance) do |v| next if v.nil? || v.appearance.nil? server_response_time = v.created_at.to_f - v.appearance.created_at.to_f if v.time_viewed && v.time_viewed/1000 > server_response_time badvotes << v - puts "." + print "." end end puts "\n" if badvotes.any? - puts "You are about to change #{badvotes.size} votes. Are you sure you want to proceed? (y/N)" - choice = $stdin.gets - - unless choice.chomp.downcase == "y" - return - end badvotes.each do |v| v.time_viewed = nil -- libgit2 0.21.2