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
This commit is contained in:
guylapid 2021-07-24 01:57:41 +03:00 committed by GitHub
parent b3ae6e50de
commit dc92c28e68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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.")
};
}