diff --git a/.rubocop.yml b/.rubocop.yml index 17fc8fa9..dd69bab0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -163,4 +163,7 @@ Style/SlicingWithRange: Performance/StringIdentifierArgument: Exclude: - 'test/support/websocket_test_plugin.rb' - - 'test/support/requests/plugins/upgrade.rb' \ No newline at end of file + - 'test/support/requests/plugins/upgrade.rb' + +Style/Lambda: + Enabled: false diff --git a/lib/httpx/pool.rb b/lib/httpx/pool.rb index c18c8f61..86797302 100644 --- a/lib/httpx/pool.rb +++ b/lib/httpx/pool.rb @@ -14,7 +14,6 @@ module HTTPX def initialize @resolvers = {} - @_resolver_ios = {} @timers = Timers.new @selector = Selector.new @connections = [] @@ -111,7 +110,7 @@ module HTTPX resolver << connection return if resolver.empty? - @_resolver_ios[resolver] ||= select_connection(resolver) + select_connection(resolver) end def on_resolver_connection(connection) @@ -143,7 +142,6 @@ module HTTPX @resolvers.delete(resolver_type) deselect_connection(resolver) - @_resolver_ios.delete(resolver) resolver.close unless resolver.closed? end diff --git a/sig/pool.rbs b/sig/pool.rbs index 6006a595..d316a71a 100644 --- a/sig/pool.rbs +++ b/sig/pool.rbs @@ -1,14 +1,20 @@ module HTTPX class Pool + @resolvers: Hash[Class, Resolver::Resolver] + @timers: Timers + @selector: Selector + @connections: Array[Connection] + @connected_connections: Integer + def empty?: () -> void def next_tick: () -> void - def close: (*Array[Connection]) -> void + def close: (?Array[Connection] connections) -> void - def init_connection: (Connection, Options) -> void + def init_connection: (Connection connection, Options options) -> void - def find_connection: (generic_uri, Options) -> Connection? + def find_connection: (URI::Generic uri, Options options) -> Connection? def deactivate: (*Array[Connection]) -> void @@ -28,13 +34,13 @@ module HTTPX def unregister_connection: (Connection) -> void - def select_connection: (resolver | Connection connection) -> void + def select_connection: (Resolver::Resolver | Connection connection) -> void - def deselect_connection: (resolver | Connection connection) -> void + def deselect_connection: (Resolver::Resolver | Connection connection) -> void - def coalesce_connections: (Connection, Connection) -> void + def coalesce_connections: (Connection coalescable, Connection coalescing) -> void - def next_timeout: () -> Numeric? + def next_timeout: () -> (Integer | Float | nil) def find_resolver_for: (Connection) -> Resolver::Resolver end