mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
client fallsback back on an error response if a timeout has been achieved, this way enabling to return successful responses
This commit is contained in:
parent
65722a3b12
commit
167970cb65
@ -85,12 +85,20 @@ module HTTPX
|
||||
|
||||
# guarantee ordered responses
|
||||
loop do
|
||||
request = requests.shift
|
||||
@connection.next_tick until response = fetch_response(request)
|
||||
begin
|
||||
request = requests.first
|
||||
@connection.next_tick until response = fetch_response(request)
|
||||
|
||||
responses << response
|
||||
responses << response
|
||||
requests.shift
|
||||
|
||||
break if requests.empty?
|
||||
break if requests.empty?
|
||||
rescue TimeoutError => e
|
||||
while requests.shift
|
||||
responses << ErrorResponse.new(e.message, 0)
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
requests.size == 1 ? responses.first : responses
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user