mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 18:40:24 +00:00
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:
@@ -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(())
|
||||
|
||||
Reference in New Issue
Block a user