Add Errno::EHOSTUNREACH to Podcasts's rescue list (#16884)
* Add Errno::EHOSTUNREACH to Podcasts's rescue list * Add spec
This commit is contained in:
parent
dc903f836c
commit
b81d8c9479
2 changed files with 10 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ module Podcasts
|
|||
end
|
||||
podcast.update_columns(reachable: true, status_notice: "")
|
||||
feed.items.size
|
||||
rescue Net::OpenTimeout, Errno::ECONNREFUSED, SocketError, HTTParty::RedirectionTooDeep
|
||||
rescue Net::OpenTimeout, Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError, HTTParty::RedirectionTooDeep
|
||||
set_unreachable(status: :unreachable, force_update: force_update)
|
||||
rescue OpenSSL::SSL::SSLError
|
||||
set_unreachable(status: :ssl_failed, force_update: force_update)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,15 @@ RSpec.describe Podcasts::Feed, type: :service, vcr: vcr_option do
|
|||
expect(unpodcast.status_notice).to include("is not reachable")
|
||||
end
|
||||
|
||||
it "sets reachable when hitting ip issue" do
|
||||
allow(HTTParty).to receive(:get).with("http://podcast.example.com/podcast", httparty_options).and_raise(
|
||||
Errno::EHOSTUNREACH,
|
||||
)
|
||||
described_class.new(unpodcast).get_episodes(limit: 2)
|
||||
unpodcast.reload
|
||||
expect(unpodcast.reachable).to be false
|
||||
end
|
||||
|
||||
it "sets reachable when there redirection is too deep" do
|
||||
allow(HTTParty).to receive(:get).with("http://podcast.example.com/podcast", httparty_options).and_raise(
|
||||
HTTParty::RedirectionTooDeep, "too deep"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue