mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-02 23:35:20 +00:00
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:
parent
b3ae6e50de
commit
dc92c28e68
@ -105,7 +105,8 @@ pub use tokio_rustls::{client::TlsStream, TlsConnector};
|
|||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! blocking {
|
macro_rules! blocking {
|
||||||
($($expr:tt)*) => {
|
($($expr:tt)*) => {
|
||||||
$crate::tokio::task::block_in_place(move || { $($expr)* })
|
$crate::tokio::task::spawn_blocking(move || { $($expr)* })
|
||||||
|
.await.expect("Blocking task failed to complete.")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user