Skip to content

Commit dc92c28

Browse files
authored
Use tokio spawn_blocking instead of block_in_place (#1333)
This fixes a panic when sharing an SQLite connection pool between tokio runtime and actix runtime
1 parent b3ae6e5 commit dc92c28

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sqlx-rt/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ pub use tokio_rustls::{client::TlsStream, TlsConnector};
105105
#[macro_export]
106106
macro_rules! blocking {
107107
($($expr:tt)*) => {
108-
$crate::tokio::task::block_in_place(move || { $($expr)* })
108+
$crate::tokio::task::spawn_blocking(move || { $($expr)* })
109+
.await.expect("Blocking task failed to complete.")
109110
};
110111
}
111112

0 commit comments

Comments
 (0)