FIX: Ignore problems cooking

This commit is contained in:
Robin Ward 2016-04-14 11:30:04 -04:00
parent 5422649ba7
commit 976056bc41
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D

View file

@ -14,12 +14,16 @@ module Jobs
.find_in_batches do |group| .find_in_batches do |group|
group.each do |p| group.each do |p|
begin
# Note we can't use `p.cooked` here because oneboxes have been cooked out # Note we can't use `p.cooked` here because oneboxes have been cooked out
cooked = PrettyText.cook(p.raw) cooked = PrettyText.cook(p.raw)
doc = Nokogiri::HTML::fragment(cooked) doc = Nokogiri::HTML::fragment(cooked)
if doc.search('a.onebox').size > 0 if doc.search('a.onebox').size > 0
to_award[p.user_id] ||= { post_id: p.id, created_at: p.created_at } to_award[p.user_id] ||= { post_id: p.id, created_at: p.created_at }
end end
rescue
nil # if there is a problem cooking we don't care
end
end end
end end