From 9f12bfbb3ae9a98a4186fb620ac79c1692cf0664 Mon Sep 17 00:00:00 2001 From: Luke Baker Date: Wed, 13 Apr 2011 17:05:06 -0400 Subject: [PATCH] guard against nil vote or appearance --- lib/tasks/prune_db.rake | 1 + 1 file changed, 1 insertion(+), 0 deletions(-) diff --git a/lib/tasks/prune_db.rake b/lib/tasks/prune_db.rake index d1dea3b..58a690f 100644 --- a/lib/tasks/prune_db.rake +++ b/lib/tasks/prune_db.rake @@ -6,6 +6,7 @@ namespace :prune_db 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| + 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 -- libgit2 0.21.2