Commit 9f12bfbb3ae9a98a4186fb620ac79c1692cf0664

Authored by Luke Baker
1 parent a1a41f50

guard against nil vote or appearance

Showing 1 changed file with 1 additions and 0 deletions   Show diff stats
lib/tasks/prune_db.rake
... ... @@ -6,6 +6,7 @@ namespace :prune_db do
6 6 badvotes = []
7 7 #might want to optimize later to not start from the beginning each time
8 8 Vote.find_each(:batch_size => 1000, :include => :appearance) do |v|
  9 + next if v.nil? || v.appearance.nil?
9 10 server_response_time = v.created_at.to_f - v.appearance.created_at.to_f
10 11 if v.time_viewed && v.time_viewed/1000 > server_response_time
11 12 badvotes << v
... ...