FIX: Don't raise an error if the RSS endpoint is 404
This commit is contained in:
parent
e82084405e
commit
424fc8e2e2
|
@ -55,6 +55,9 @@ module Jobs
|
||||||
def topics
|
def topics
|
||||||
feed_topics = []
|
feed_topics = []
|
||||||
|
|
||||||
|
rss = fetch_rss
|
||||||
|
return feed_topics unless rss.present?
|
||||||
|
|
||||||
rss.items.each do |i|
|
rss.items.each do |i|
|
||||||
current_feed_topic = FeedTopic.new(i)
|
current_feed_topic = FeedTopic.new(i)
|
||||||
feed_topics << current_feed_topic if current_feed_topic.content
|
feed_topics << current_feed_topic if current_feed_topic.content
|
||||||
|
@ -65,8 +68,10 @@ module Jobs
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def rss
|
def fetch_rss
|
||||||
SimpleRSS.parse open(@feed_url, allow_redirections: :all)
|
SimpleRSS.parse open(@feed_url, allow_redirections: :all)
|
||||||
|
rescue OpenURI::HTTPError
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue