Skip to content

[Feature] Allow sharing of HttpClient instances #192

Open
@here-abarany

Description

@here-abarany

The current implementation creates a new HttpClient instance with every new request. This is inefficient as it will:

  1. Need to spin up a new Executor each time it runs for running the HTTP request in the background.
  2. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions