Skip to content

Commit 396a757

Browse files
madadamjpmelos
authored andcommitted
fix deadlock in the postgres/listen example
1 parent 330103b commit 396a757

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • examples/postgres/listen/src

examples/postgres/listen/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
6868
}
6969
}
7070

71+
// The stream is holding one connection. It needs to be dropped to allow the connection to
72+
// return to the pool, otherwise `pool.close()` would never return.
73+
drop(stream);
74+
7175
pool.close().await;
7276

7377
Ok(())

0 commit comments

Comments
 (0)