Skip to content

Initialize Client with custom HTTP client, config, and backoff #193

@GabrielBianconi

Description

@GabrielBianconi

Initializing a Client with a custom HTTP client always requires first creating a useless reqwest::Client in Client::with_config.

This adds a bit of useless overhead due to reqwest's TLS/DNS functionality, which can be non-trivial for certain low-latency applications.

Would you be open to adding an additional method along the lines of?

impl<C: Config> Client<C> {
    /// Create client with your own HTTP client, config, and backoff 
    pub fn build(http_client: reqwest::Client, config: C, backoff: backoff::ExponentialBackoff) -> Self {
        Self {
            http_client,
            config,
            backoff,
        }
    }

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions