From cd9e499b776bc04d56cbdee53e6385c3d45559f9 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 6 May 2015 16:53:28 +1000 Subject: [PATCH] Don't try loading embeds on deleted topics --- app/jobs/regular/crawl_topic_link.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/jobs/regular/crawl_topic_link.rb b/app/jobs/regular/crawl_topic_link.rb index fa64abffa86..8b54ee88993 100644 --- a/app/jobs/regular/crawl_topic_link.rb +++ b/app/jobs/regular/crawl_topic_link.rb @@ -88,7 +88,8 @@ module Jobs # Look for a topic embed for the URL. If it exists, use its title and don't crawl topic_embed = TopicEmbed.where(embed_url: topic_link.url).includes(:topic).references(:topic).first - if topic_embed.present? + # topic could be deleted, so skip + if topic_embed && topic_embed.topic TopicLink.where(id: topic_link.id).update_all(['title = ?, crawled_at = CURRENT_TIMESTAMP', topic_embed.topic.title[0..255]]) return end