mirror of
https://github.com/HoneyryderChuck/httpx.git
synced 2025-10-04 00:00:37 -04:00
defaulting to unbounded, in order to preserve current behaviour; this will cap the number of connections initiated for a given origin for a pool, which if not shared, will be per-origin; this will include connections from separate option profiles a pool timeout is defined to checkout a connection when limit is reeached
45 lines
1.3 KiB
Plaintext
45 lines
1.3 KiB
Plaintext
module HTTPX
|
|
type pool_options = {
|
|
max_connections_per_origin: Integer?,
|
|
pool_timeout: Numeric?
|
|
}
|
|
|
|
class Pool
|
|
type resolver_manager = Resolver::Multi | Resolver::System
|
|
|
|
@max_connections_per_origin: Integer
|
|
@pool_timeout: Numeric
|
|
@options: Options
|
|
@resolvers: Hash[Class, Array[resolver_manager]]
|
|
@resolver_mtx: Thread::Mutex
|
|
@connections: Hash[String, Array[Connection]]
|
|
@connection_mtx: Thread::Mutex
|
|
@origin_counters: Hash[String, Integer]
|
|
@origin_conds: Hash[String, ConditionVariable]
|
|
|
|
def pop_connection: () -> Connection?
|
|
|
|
def checkout_connection: (http_uri uri, Options options) -> Connection
|
|
|
|
def checkin_connection: (Connection connection) -> void
|
|
|
|
def checkout_mergeable_connection: (Connection connection) -> Connection?
|
|
|
|
def reset_resolvers: () -> void
|
|
|
|
def checkout_resolver: (Options options) -> resolver_manager
|
|
|
|
def checkin_resolver: (Resolver::Resolver resolver) -> void
|
|
|
|
private
|
|
|
|
def initialize: (pool_options options) -> void
|
|
|
|
def acquire_connection: (http_uri, Options options) -> Connection?
|
|
|
|
def checkout_new_connection: (http_uri uri, Options options) -> Connection
|
|
|
|
def checkout_new_resolver: (Class resolver_type, Options options) -> resolver_manager
|
|
end
|
|
end
|