Don't try loading embeds on deleted topics
This commit is contained in:
parent
2f82caafa2
commit
cd9e499b77
|
@ -88,7 +88,8 @@ module Jobs
|
||||||
|
|
||||||
# Look for a topic embed for the URL. If it exists, use its title and don't crawl
|
# 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
|
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]])
|
TopicLink.where(id: topic_link.id).update_all(['title = ?, crawled_at = CURRENT_TIMESTAMP', topic_embed.topic.title[0..255]])
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue