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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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