Skip to content
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

Cache adapter connections (attempt 1) #1061

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

technoweenie
Copy link
Member

This was an attempt to steps 2, 4, and 5 of #1024

(items copied below, since #1024 has changed)

  1. ...
  2. Send ConnectionOptions to Env as :connection key.
  3. ...
  4. Copy settings that configure the HTTP connection from RequestOptions to ConnectionOptions: :proxy, :bind, :timeout, :read_timeout, :open_timeout, :write_timeout
  5. Teach Adapter#initialize to save the connection if it can:
  • If any of the moved RequestOptions settings are used, skip this!
  • ...
  • If the adapter does not support pooling, @conn = build_connection

I started by caching the connection first, and then worrying about how to include the connection options. But, I realized I need a way to merge the connection options with request options, so that something like this will work as expected:

Faraday.new(timeout: 5, request: { write_timeout: 3 })

I think this approach was backwards. I should setup ConnectionOptions and merge it with RequestOptions at the right time, with whatever proxy changes are needed, before worrying about caching the HTTP object.

I'm keeping this PR around as an example, but I'll probably end up rewriting or cherry-picking these commits into something else later.

@iMacTia iMacTia added the parked Parked for future label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parked Parked for future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants