remove traces of the retries parameter, which wasn't being used anyway

This commit is contained in:
HoneyryderChuck 2018-06-06 12:21:11 +01:00
parent 28a7721774
commit a54fab5998
7 changed files with 15 additions and 22 deletions

View File

@ -206,7 +206,7 @@ module HTTPX
end end
end end
parser.on(:error) do |request, ex| parser.on(:error) do |request, ex|
response = ErrorResponse.new(ex, 0, @options) response = ErrorResponse.new(ex, @options)
emit(:response, request, response) emit(:response, request, response)
end end
parser parser
@ -247,7 +247,7 @@ module HTTPX
def handle_error(e) def handle_error(e)
parser.handle_error(e) parser.handle_error(e)
response = ErrorResponse.new(e, 0, @options) response = ErrorResponse.new(e, @options)
@pending.each do |request, _| @pending.each do |request, _|
emit(:response, request, response) emit(:response, request, response)
end end

View File

@ -51,13 +51,14 @@ module HTTPX
end end
def fetch_response(request) def fetch_response(request)
response = @responses.delete(request) @responses.delete(request)
if response.is_a?(ErrorResponse) && response.retryable? #response = @responses.delete(request)
channel = find_channel(request) #if response.is_a?(ErrorResponse)
channel.send(request, retries: response.retries - 1) # channel = find_channel(request)
return # channel.send(request)
end # return
response #end
#response
end end
def find_channel(request, **options) def find_channel(request, **options)

View File

@ -3,7 +3,6 @@
module HTTPX module HTTPX
class Options class Options
MAX_CONCURRENT_REQUESTS = 100 MAX_CONCURRENT_REQUESTS = 100
MAX_RETRIES = 3
WINDOW_SIZE = 1 << 14 # 16K WINDOW_SIZE = 1 << 14 # 16K
MAX_BODY_THRESHOLD_SIZE = (1 << 10) * 112 # 112K MAX_BODY_THRESHOLD_SIZE = (1 << 10) * 112 # 112K
@ -47,7 +46,6 @@ module HTTPX
:timeout => Timeout.new, :timeout => Timeout.new,
:headers => {}, :headers => {},
:max_concurrent_requests => MAX_CONCURRENT_REQUESTS, :max_concurrent_requests => MAX_CONCURRENT_REQUESTS,
:max_retries => MAX_RETRIES,
:window_size => WINDOW_SIZE, :window_size => WINDOW_SIZE,
:body_threshold_size => MAX_BODY_THRESHOLD_SIZE, :body_threshold_size => MAX_BODY_THRESHOLD_SIZE,
:request_class => Class.new(Request), :request_class => Class.new(Request),
@ -86,7 +84,7 @@ module HTTPX
%w[ %w[
params form json body params form json body
follow ssl http2_settings max_retries follow ssl http2_settings
request_class response_class headers_class request_body_class response_body_class request_class response_class headers_class request_body_class response_body_class
io fallback_protocol debug debug_level io fallback_protocol debug debug_level
].each do |method_name| ].each do |method_name|

View File

@ -30,7 +30,7 @@ module HTTPX
transition(:connected) transition(:connected)
throw(:called) throw(:called)
else else
response = ErrorResponse.new(Error.new("socks error: #{status}"), 0, @options) response = ErrorResponse.new(Error.new("socks error: #{status}"), @options)
until @pending.empty? until @pending.empty?
req, _ = @pending.shift req, _ = @pending.shift
emit(:response, req, response) emit(:response, req, response)

View File

@ -95,7 +95,7 @@ module HTTPX
end end
def on_error_response(error) def on_error_response(error)
response = ErrorResponse.new(Error.new(error), 0, @options) response = ErrorResponse.new(Error.new(error), @options)
until @pending.empty? until @pending.empty?
req, _ = @pending.shift req, _ = @pending.shift
emit(:response, req, response) emit(:response, req, response)

View File

@ -216,11 +216,10 @@ module HTTPX
class ErrorResponse class ErrorResponse
include Loggable include Loggable
attr_reader :error, :retries attr_reader :error
def initialize(error, retries, options) def initialize(error, options)
@error = error @error = error
@retries = retries
@options = Options.new(options) @options = Options.new(options)
log { "#{error.class}: #{error}" } log { "#{error.class}: #{error}" }
log { caller.join("\n") } log { caller.join("\n") }
@ -233,9 +232,5 @@ module HTTPX
def raise_for_status def raise_for_status
raise @error raise @error
end end
def retryable?
@retries.positive?
end
end end
end end

View File

@ -70,7 +70,6 @@ class OptionsSpec < Minitest::Test
:fallback_protocol => "http/1.1", :fallback_protocol => "http/1.1",
:headers => { "Foo" => "foo", "Accept" => "xml", "Bar" => "bar" }, :headers => { "Foo" => "foo", "Accept" => "xml", "Bar" => "bar" },
:max_concurrent_requests => 100, :max_concurrent_requests => 100,
:max_retries => 3,
:request_class => bar.request_class, :request_class => bar.request_class,
:response_class => bar.response_class, :response_class => bar.response_class,
:headers_class => bar.headers_class, :headers_class => bar.headers_class,