Open
Description
The current implementation creates a new HttpClient
instance with every new request. This is inefficient as it will:
- Need to spin up a new Executor each time it runs for running the HTTP request in the background.
- Cannot keep connections alive between requests.
To avoid HttpClient
instances consuming resources longer than intended, I would propose a case class be introduced to manage an HttpClient
with the client-specific parameters. A new overload of the existing request functions can be introduced that provides the client rather than the client-specific parameters (e.g. proxy, connect timeout), while the existing overloads can create a client instance on the fly as it does today. Users of the library could then opt into keeping longer-lived clients, while existing calls should behave the same as before.
Metadata
Metadata
Assignees
Labels
No labels