fix: do not apply timeout errors on inactive conns

when selector emits a timeout error, the full list of connections in the
pool is traversed. This is in itself not very performant, but the
problem is that the accounting is also done with connection which
weren't selected, such as the inactive connections. So we skip this for
them for now.
This commit is contained in:
HoneyryderChuck 2022-01-07 01:11:04 +02:00
parent 9aeaf437ef
commit fde8ea3276

View File

@ -554,6 +554,10 @@ module HTTPX
ex.set_backtrace(error.backtrace)
error = ex
else
# inactive connections do not contribute to the select loop, therefore
# they should fail due to such errors.
return if @state == :inactive
if @timeout
@timeout -= error.timeout
return unless @timeout <= 0