From 98639aece6f96a60cb7eb9bb41fa34b157f34f5e Mon Sep 17 00:00:00 2001 From: Dylan Date: Mon, 27 Nov 2023 18:28:57 +0800 Subject: [PATCH] feat(batch): improve connection pool value (#13669) --- src/rpc_client/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rpc_client/src/lib.rs b/src/rpc_client/src/lib.rs index 52f299aa8813b..0a8c774298b3c 100644 --- a/src/rpc_client/src/lib.rs +++ b/src/rpc_client/src/lib.rs @@ -69,8 +69,10 @@ pub use stream_client::{StreamClient, StreamClientPool, StreamClientPoolRef}; pub trait RpcClient: Send + Sync + 'static + Clone { async fn new_client(host_addr: HostAddr) -> Result; - async fn new_clients(host_addr: HostAddr, size: usize) -> Result> { - try_join_all(repeat(host_addr).take(size).map(Self::new_client)).await + async fn new_clients(host_addr: HostAddr, size: usize) -> Result>> { + try_join_all(repeat(host_addr).take(size).map(Self::new_client)) + .await + .map(Arc::new) } } @@ -78,7 +80,7 @@ pub trait RpcClient: Send + Sync + 'static + Clone { pub struct RpcClientPool { connection_pool_size: u16, - clients: Cache>, + clients: Cache>>, } impl Default for RpcClientPool