Description
We recently attempted to add the faraday-net_http_persistent adapter to our Koala stack and noticed that it wasn't behaving as expected.
After tracing it down, I don't believe Koala is compatible with this adapter because Koala::HTTPService.make_request
will create a new Faraday instance for every request:
koala/lib/koala/http_service.rb
Lines 49 to 50 in c327913
In doing this, a new connection pool is created each time so there's nothing to share between requests.
I don't believe this is trivial change as the way around it is to create a Faraday connection first (so the middleware stack is built once), and then invokes requests on that connection (a bit similar to the example here). That might be a bit too breaking depending on how folks are using this library 🤔
koala/lib/koala/api/graph_api_methods.rb
Lines 54 to 57 in c327913
Lines 46 to 49 in c327913
Lines 121 to 122 in c327913
Lines 60 to 63 in c327913
koala/lib/koala/http_service.rb
Lines 48 to 50 in c327913