From 424fc8e2e21cf5d2f8d83b8cdee7d32d182568ec Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Mon, 5 Dec 2016 12:29:14 -0500 Subject: [PATCH] FIX: Don't raise an error if the RSS endpoint is 404 --- app/jobs/scheduled/poll_feed.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/jobs/scheduled/poll_feed.rb b/app/jobs/scheduled/poll_feed.rb index 8cfed445714..8c0e1e75b33 100644 --- a/app/jobs/scheduled/poll_feed.rb +++ b/app/jobs/scheduled/poll_feed.rb @@ -55,6 +55,9 @@ module Jobs def topics feed_topics = [] + rss = fetch_rss + return feed_topics unless rss.present? + rss.items.each do |i| current_feed_topic = FeedTopic.new(i) feed_topics << current_feed_topic if current_feed_topic.content @@ -65,8 +68,10 @@ module Jobs private - def rss + def fetch_rss SimpleRSS.parse open(@feed_url, allow_redirections: :all) + rescue OpenURI::HTTPError + nil end end