Skip to content

Connection Pooling support in faraday adapters #1421

Answered by iMacTia
MaryamAdnan3 asked this question in Help
Discussion options

You must be logged in to vote

Hey @MaryamAdnan3 👋, connection_pool is exactly the gem I used in #1006, but that has nothing to do with HTTP connections. That gem is simply providing you with mutexed access to shared resources. This is obviously useful for managing connections across threads/fibers, but you could technically put whatever you want in there 😄.

In fact, in your code snippet you're actually storing Faraday::Connection objects in the pool. This actually works, but I doubt is achieving the desired behaviour.
For example, if your Faraday.default_adapter is net_http, that means that when you check in a connection and use it to make a request, you're still creating a new Net::HTTP object, which will open a new …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MaryamAdnan3
Comment options

Answer selected by MaryamAdnan3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants