Skip to content

Commit 324408b

Browse files
dswijseanmonstar
authored andcommitted
fix(client): no keep-alive always returning an error
1 parent 4d1ed57 commit 324408b

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/client/legacy/client.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,14 @@ where
382382
&self,
383383
pool_key: PoolKey,
384384
) -> Result<pool::Pooled<PoolClient<B>, PoolKey>, ClientConnectError> {
385+
// Return a single connection if pooling is not enabled
386+
if !self.pool.is_enabled() {
387+
return self
388+
.connect_to(pool_key)
389+
.await
390+
.map_err(ClientConnectError::Normal);
391+
}
392+
385393
// This actually races 2 different futures to try to get a ready
386394
// connection the fastest, and to reduce connection churn.
387395
//
@@ -1456,7 +1464,6 @@ impl fmt::Debug for Builder {
14561464
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
14571465
f.debug_struct("Builder")
14581466
.field("client_config", &self.client_config)
1459-
//.field("conn_builder", &self.conn_builder)
14601467
.field("pool_config", &self.pool_config)
14611468
.finish()
14621469
}

src/client/legacy/pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl<T, K: Key> Pool<T, K> {
138138
Pool { inner }
139139
}
140140

141-
fn is_enabled(&self) -> bool {
141+
pub(crate) fn is_enabled(&self) -> bool {
142142
self.inner.is_some()
143143
}
144144

0 commit comments

Comments
 (0)