Pool.close: close all connections before returning (#3952)

* fix race condition in pool close (#3217)

* fix deadlock in the postgres/listen example

* Only acquire as many permits as a child pool can offer

---------

Co-authored-by: Adam Cigánek <adam.ciganek@proton.me>
This commit is contained in:
João Sampaio
2025-08-15 20:20:51 -04:00
committed by GitHub
parent ed002f89e5
commit 5f8fc6b752
2 changed files with 19 additions and 10 deletions

View File

@@ -68,6 +68,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
}
// The stream is holding one connection. It needs to be dropped to allow the connection to
// return to the pool, otherwise `pool.close()` would never return.
drop(stream);
pool.close().await;
Ok(())