mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-08 00:02:42 -04:00
due to how read timeouts are added on request transitions, timers may enter the pool **before** a new tick happens, and are therefore accounted for when the timers are fired after the current tick. This patch resets the timer, which will force a new tick before they may fire again.
35 lines
744 B
Ruby
35 lines
744 B
Ruby
# frozen_string_literal: true
|
|
|
|
require "webrick"
|
|
require "webrick/httpproxy"
|
|
require "test_helper"
|
|
require "support/http_helpers"
|
|
require "support/proxy_helper"
|
|
require "support/minitest_extensions"
|
|
|
|
class Bug_1_1_0_Test < Minitest::Test
|
|
include HTTPHelpers
|
|
|
|
def test_read_timeout_firing_too_soon_before_select
|
|
timeout = { read_timeout: 1 }
|
|
|
|
uri = build_uri("/get")
|
|
|
|
begin
|
|
response = HTTPX.get(uri, timeout: timeout)
|
|
response.raise_for_status
|
|
sleep 2
|
|
response = HTTPX.get(uri, timeout: timeout)
|
|
response.raise_for_status
|
|
rescue HTTPX::ReadTimeoutError
|
|
raise Minitest::Assertion, "should not have raised a read timeout error"
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def scheme
|
|
"http://"
|
|
end
|
|
end
|