httpx/regression_tests/bug_1_1_0_test.rb
HoneyryderChuck f477871bfa reset timer baseline interval when adding new timers
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.
2023-11-03 12:12:05 +00:00

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