diff --git a/src/conn/pool/mod.rs b/src/conn/pool/mod.rs index 34303845..16888050 100644 --- a/src/conn/pool/mod.rs +++ b/src/conn/pool/mod.rs @@ -285,6 +285,11 @@ impl Pool { impl Drop for Conn { fn drop(&mut self) { if std::thread::panicking() { + // Try to decrease the number of existing connections. + if let Some(pool) = self.inner.pool.take() { + pool.cancel_connection(); + } + return; }