Open
Description
This is a tracking issue for a larger effort to refactor the adapters to support connection pools. #1006 proved it could work in theory, but I think the code bass will need some more massaging to fully support it. I outlined why in #1006 (comment).
TODO
- Add
#build_connection
to every adapter, which outputs the fully-configured http client from options. Cleanup adapter connections #1023 - Send
ConnectionOptions
to Env as:connection
key. - Copy settings that configure the HTTP connection from
RequestOptions
toConnectionOptions
::proxy, :bind, :timeout, :read_timeout, :open_timeout, :write_timeout
- Teach
Adapter#build_connection
to mergeConnectionOptions
withRequestOptions
. - Remove manual merging of
:proxy
intoRequestOptions
- Teach
Adapter#initialize
to save the connection if it can:- If any of the moved
RequestOptions
settings are used, skip this! - If the adapter supports pooling,
@pool = ConnectionPool.new(opts, &method(:build_connection))
- If the adapter does not support pooling,
@conn = build_connection
- If any of the moved
- Add
connection(&block)
to yield a connection for the adapter to use:- If any of the moved
RequestOptions
settings are used, yield#build_connection
) - If the adapter supports pooling, pass block to
@pool.with
- If the adapter does not support pooling, yield
@conn
- If any of the moved
Proxy options???
faraday/lib/faraday/connection.rb
Lines 493 to 497 in ba7b82d
Metadata
Metadata
Assignees
Labels
No labels