lib/httpx/connection.rb in httpx-0.6.3 vs lib/httpx/connection.rb in httpx-0.6.4
- old
+ new
@@ -126,13 +126,13 @@
end
end
end
def purge_pending
- [@parser.pending, @pending].each do |pending|
- pending.reject! do |request, *args|
- yield(request, args) if block_given?
+ [*@parser.pending, *@pending].each do |pending|
+ pending.reject! do |request|
+ yield request
end
end
end
# checks if this is connection is an alternative service of
@@ -356,18 +356,20 @@
handle_error(ex)
reset
end
def handle_error(error)
- if error.instance_of?(TimeoutError) && @timeout
- @timeout -= error.timeout
- return unless @timeout <= 0
+ if error.instance_of?(TimeoutError)
+ if @timeout
+ @timeout -= error.timeout
+ return unless @timeout <= 0
+ end
error = error.to_connection_error if connecting?
end
parser.handle_error(error) if @parser && parser.respond_to?(:handle_error)
- @pending.each do |request, _|
+ @pending.each do |request|
request.emit(:response, ErrorResponse.new(request, error, @options))
end
end
end
end