-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: Connection Pooling #1024
Comments
@technoweenie This totally looks like a breaking change. Is it OK to schedule it for Faraday 1.0? |
It's not meant to be a breaking change. I modified step 4 from: -Move settings that configure the HTTP connection...
+Copy settings that configure the HTTP connection... Steps 5 and 6 will check to see if any of the connection-level properties are set on the request, and if so will generate a brand new connection object (current behavior). That said, I do think this is a fairly risky change. I also think it might be necessary... While looking at |
And I assume the request options would take priority over the connection ones.
Being a bit more strict on the connection initialisation and usage would ease some of the configuration issues, but would of course make it less backwards-compatible. I appreciate the take on this though, it was definitely in my 2.0 list 😅 |
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
#build_connection
to every adapter, which outputs the fully-configured http client from options. Cleanup adapter connections #1023ConnectionOptions
to Env as:connection
key.RequestOptions
toConnectionOptions
::proxy, :bind, :timeout, :read_timeout, :open_timeout, :write_timeout
Adapter#build_connection
to mergeConnectionOptions
withRequestOptions
.:proxy
intoRequestOptions
Adapter#initialize
to save the connection if it can:RequestOptions
settings are used, skip this!@pool = ConnectionPool.new(opts, &method(:build_connection))
@conn = build_connection
connection(&block)
to yield a connection for the adapter to use:RequestOptions
settings are used, yield#build_connection
)@pool.with
@conn
Proxy options???
faraday/lib/faraday/connection.rb
Lines 493 to 497 in ba7b82d
The text was updated successfully, but these errors were encountered: