mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-08 00:02:42 -04:00
Merge branch 'issue-261' into 'master'
reset timer baseline interval when adding new timers Closes #261 See merge request os85/httpx!290
This commit is contained in:
commit
18f2bea9b0
@ -62,8 +62,11 @@ module HTTPX
|
|||||||
addresses.first.to_s != connection.origin.host.to_s
|
addresses.first.to_s != connection.origin.host.to_s
|
||||||
log { "resolver: A response, applying resolution delay..." }
|
log { "resolver: A response, applying resolution delay..." }
|
||||||
@pool.after(0.05) do
|
@pool.after(0.05) do
|
||||||
# double emission check
|
unless connection.state == :closed ||
|
||||||
emit_resolved_connection(connection, addresses) unless connection.addresses && addresses.intersect?(connection.addresses)
|
# double emission check
|
||||||
|
(connection.addresses && addresses.intersect?(connection.addresses))
|
||||||
|
emit_resolved_connection(connection, addresses)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
emit_resolved_connection(connection, addresses)
|
emit_resolved_connection(connection, addresses)
|
||||||
|
@ -24,6 +24,8 @@ module HTTPX
|
|||||||
|
|
||||||
interval << callback
|
interval << callback
|
||||||
|
|
||||||
|
@next_interval_at = nil
|
||||||
|
|
||||||
interval
|
interval
|
||||||
end
|
end
|
||||||
|
|
||||||
|
34
regression_tests/bug_1_1_0_test.rb
Normal file
34
regression_tests/bug_1_1_0_test.rb
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# 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
|
Loading…
x
Reference in New Issue
Block a user