Skip to content

Commit

Permalink
fix(http client): impl Clone (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasad1 authored Nov 29, 2021
1 parent 8c86769 commit 15b2f23
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions http-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use crate::types::{
use async_trait::async_trait;
use fnv::FnvHashMap;
use serde::de::DeserializeOwned;
use std::time::Duration;
use std::{sync::Arc, time::Duration};

/// Http Client Builder.
#[derive(Debug)]
Expand Down Expand Up @@ -75,7 +75,7 @@ impl HttpClientBuilder {
.map_err(|e| Error::Transport(e.into()))?;
Ok(HttpClient {
transport,
id_manager: RequestIdManager::new(self.max_concurrent_requests),
id_manager: Arc::new(RequestIdManager::new(self.max_concurrent_requests)),
request_timeout: self.request_timeout,
})
}
Expand All @@ -93,14 +93,14 @@ impl Default for HttpClientBuilder {
}

/// JSON-RPC HTTP Client that provides functionality to perform method calls and notifications.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct HttpClient {
/// HTTP transport client.
transport: HttpTransportClient,
/// Request timeout. Defaults to 60sec.
request_timeout: Duration,
/// Request ID manager.
id_manager: RequestIdManager,
id_manager: Arc<RequestIdManager>,
}

#[async_trait]
Expand Down

1 comment on commit 15b2f23

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 15b2f23 Previous: 8c86769 Ratio
subscriptions/unsub 3497 ns/iter (± 742) 1156 ns/iter (± 135) 3.03

This comment was automatically generated by workflow using github-action-benchmark.

CC: @niklasad1 @maciejhirsz

Please sign in to comment.