From 976056bc412582625f52b573f10437b7f59d6ee5 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 14 Apr 2016 11:30:04 -0400 Subject: [PATCH] FIX: Ignore problems cooking --- app/jobs/onceoff/grant_onebox.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/jobs/onceoff/grant_onebox.rb b/app/jobs/onceoff/grant_onebox.rb index 8479528054c..131d29a167c 100644 --- a/app/jobs/onceoff/grant_onebox.rb +++ b/app/jobs/onceoff/grant_onebox.rb @@ -14,11 +14,15 @@ module Jobs .find_in_batches do |group| group.each do |p| - # Note we can't use `p.cooked` here because oneboxes have been cooked out - cooked = PrettyText.cook(p.raw) - doc = Nokogiri::HTML::fragment(cooked) - if doc.search('a.onebox').size > 0 - to_award[p.user_id] ||= { post_id: p.id, created_at: p.created_at } + begin + # Note we can't use `p.cooked` here because oneboxes have been cooked out + cooked = PrettyText.cook(p.raw) + doc = Nokogiri::HTML::fragment(cooked) + if doc.search('a.onebox').size > 0 + to_award[p.user_id] ||= { post_id: p.id, created_at: p.created_at } + end + rescue + nil # if there is a problem cooking we don't care end end