Skip to content

Commit bc7cd0e

Browse files
authored
Migrate to AsyncPgConnection::try_from_client_and_connection() (#9826)
see weiznich/diesel_async#189
1 parent 0cac9a2 commit bc7cd0e

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

src/db.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,7 @@ async fn establish_async_connection(
9696
let connector = MakeTlsConnector::new(connector);
9797
let result = tokio_postgres::connect(url, connector).await;
9898
let (client, conn) = result.map_err(|err| BadConnection(err.to_string()))?;
99-
100-
tokio::spawn(async move {
101-
if let Err(e) = conn.await {
102-
eprintln!("Database connection: {e}");
103-
}
104-
});
105-
106-
AsyncPgConnection::try_from(client).await
99+
AsyncPgConnection::try_from_client_and_connection(client, conn).await
107100
}
108101

109102
#[derive(Debug, Clone, Copy)]

0 commit comments

Comments
 (0)