Skip to content

fix(client): no keep-alive always returning an error #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/client/legacy/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,14 @@ where
&self,
pool_key: PoolKey,
) -> Result<pool::Pooled<PoolClient<B>, PoolKey>, ClientConnectError> {
// Return a single connection if pooling is not enabled
if !self.pool.is_enabled() {
return self
.connect_to(pool_key)
.await
.map_err(ClientConnectError::Normal);
}

// This actually races 2 different futures to try to get a ready
// connection the fastest, and to reduce connection churn.
//
Expand Down Expand Up @@ -1456,7 +1464,6 @@ impl fmt::Debug for Builder {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Builder")
.field("client_config", &self.client_config)
//.field("conn_builder", &self.conn_builder)
.field("pool_config", &self.pool_config)
.finish()
}
Expand Down
2 changes: 1 addition & 1 deletion src/client/legacy/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl<T, K: Key> Pool<T, K> {
Pool { inner }
}

fn is_enabled(&self) -> bool {
pub(crate) fn is_enabled(&self) -> bool {
self.inner.is_some()
}

Expand Down