Skip to content

Commit

Permalink
Use tokio spawn_blocking instead of block_in_place (#1333)
Browse files Browse the repository at this point in the history
This fixes a panic when sharing an SQLite connection pool between tokio runtime and actix runtime
  • Loading branch information
guylapid authored Jul 23, 2021
1 parent b3ae6e5 commit dc92c28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sqlx-rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ pub use tokio_rustls::{client::TlsStream, TlsConnector};
#[macro_export]
macro_rules! blocking {
($($expr:tt)*) => {
$crate::tokio::task::block_in_place(move || { $($expr)* })
$crate::tokio::task::spawn_blocking(move || { $($expr)* })
.await.expect("Blocking task failed to complete.")
};
}

Expand Down

0 comments on commit dc92c28

Please sign in to comment.