mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-06 00:02:08 -04:00
adding :close_handshake_timeout timeout option
used to monitor readiness of connection to write the last goaway frame from HTTP/2
This commit is contained in:
parent
7345c19d5d
commit
100394b29c
@ -73,8 +73,11 @@ module HTTPX
|
||||
end
|
||||
|
||||
def close
|
||||
@connection.goaway unless @connection.state == :closed
|
||||
emit(:close)
|
||||
unless @connection.state == :closed
|
||||
@connection.goaway
|
||||
emit(:timeout, @options.timeout[:close_handshake_timeout])
|
||||
end
|
||||
end
|
||||
|
||||
def empty?
|
||||
|
@ -11,6 +11,7 @@ module HTTPX
|
||||
MAX_BODY_THRESHOLD_SIZE = (1 << 10) * 112 # 112K
|
||||
KEEP_ALIVE_TIMEOUT = 20
|
||||
SETTINGS_TIMEOUT = 10
|
||||
CLOSE_HANDSHAKE_TIMEOUT = 10
|
||||
CONNECT_TIMEOUT = READ_TIMEOUT = WRITE_TIMEOUT = 60
|
||||
REQUEST_TIMEOUT = OPERATION_TIMEOUT = nil
|
||||
|
||||
@ -39,6 +40,7 @@ module HTTPX
|
||||
:timeout => {
|
||||
connect_timeout: CONNECT_TIMEOUT,
|
||||
settings_timeout: SETTINGS_TIMEOUT,
|
||||
close_handshake_timeout: CLOSE_HANDSHAKE_TIMEOUT,
|
||||
operation_timeout: OPERATION_TIMEOUT,
|
||||
keep_alive_timeout: KEEP_ALIVE_TIMEOUT,
|
||||
read_timeout: READ_TIMEOUT,
|
||||
|
@ -9,9 +9,10 @@ module HTTPX
|
||||
OPERATION_TIMEOUT: Integer
|
||||
KEEP_ALIVE_TIMEOUT: Integer
|
||||
SETTINGS_TIMEOUT: Integer
|
||||
CLOSE_HANDSHAKE_TIMEOUT: Integer
|
||||
DEFAULT_OPTIONS: Hash[Symbol, untyped]
|
||||
|
||||
type timeout_type = :connect_timeout | :settings_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
|
||||
type timeout_type = :connect_timeout | :settings_timeout | :close_handshake_timeout | :operation_timeout | :keep_alive_timeout | :read_timeout | :write_timeout | :request_timeout
|
||||
type timeout = Hash[timeout_type, Numeric?]
|
||||
|
||||
def self.new: (?options) -> instance
|
||||
|
@ -80,6 +80,7 @@ class OptionsTest < Minitest::Test
|
||||
:timeout => {
|
||||
connect_timeout: 60,
|
||||
settings_timeout: 10,
|
||||
close_handshake_timeout: 10,
|
||||
operation_timeout: nil,
|
||||
keep_alive_timeout: 20,
|
||||
read_timeout: 60,
|
||||
|
Loading…
x
Reference in New Issue
Block a user