Dont let HTTParty::RedirectionTooDeep Errors kill Podcast Ep. Update Workers (#6735) [deploy]
Co-authored-by: lightalloy <lightallloy@gmail.com
This commit is contained in:
parent
68dedc8a47
commit
c3b88d19de
2 changed files with 10 additions and 3 deletions
|
|
@ -20,11 +20,11 @@ module Podcasts
|
|||
end
|
||||
podcast.update_columns(reachable: true, status_notice: "")
|
||||
feed.items.size
|
||||
rescue Net::OpenTimeout, Errno::ECONNREFUSED, SocketError => _e
|
||||
rescue Net::OpenTimeout, Errno::ECONNREFUSED, SocketError, HTTParty::RedirectionTooDeep
|
||||
set_unreachable(:unreachable, force_update)
|
||||
rescue OpenSSL::SSL::SSLError => _e
|
||||
rescue OpenSSL::SSL::SSLError
|
||||
set_unreachable(:ssl_failed, force_update)
|
||||
rescue RSS::NotWellFormedError => _e
|
||||
rescue RSS::NotWellFormedError
|
||||
set_unreachable(:unparsable, force_update)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,13 @@ RSpec.describe Podcasts::Feed, type: :service, vcr: vcr_option do
|
|||
expect(unpodcast.status_notice).to include("is not reachable")
|
||||
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")
|
||||
described_class.new(unpodcast).get_episodes(limit: 2)
|
||||
unpodcast.reload
|
||||
expect(unpodcast.reachable).to be false
|
||||
end
|
||||
|
||||
it "schedules the update url jobs when setting as unreachable" do
|
||||
allow(HTTParty).to receive(:get).with("http://podcast.example.com/podcast", httparty_options).and_raise(Errno::ECONNREFUSED)
|
||||
create_list(:podcast_episode, 2, podcast: unpodcast)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue