From dc92c28e68d99e993e420080927fc7fd5d699fbd Mon Sep 17 00:00:00 2001 From: guylapid <53928652+guylapid@users.noreply.github.com> Date: Sat, 24 Jul 2021 01:57:41 +0300 Subject: [PATCH] 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 --- sqlx-rt/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sqlx-rt/src/lib.rs b/sqlx-rt/src/lib.rs index 9c9a68a534..4b5cd77823 100644 --- a/sqlx-rt/src/lib.rs +++ b/sqlx-rt/src/lib.rs @@ -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.") }; }