You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The type RelationDef is not Send, which broke a lot of code in multithreaded environments, because async runtimes needs Futures which implement Send.
Steps to Reproduce
Compile example code below
Expected Behavior
Should compile
Actual Behavior
It doesn't compiles, because tokio::spawn expects a Future that is Send.
Reproduces How Often
always
Versions
sea-orm: v0.9.0
database: sqlite (but it happens with all of them)
OS: Arch Linux kernel 5.18.10
Additional Information
Example code that compiles on sea-orm v0.8.0, but not on v0.9.0
Cargo.toml:
[package]
name = "send"version = "0.1.0"edition = "2021"
[dependencies]
sea-orm = { version = "0.9.0", features = ["sqlx-sqlite", "runtime-tokio-rustls", "macros"], default-features = false }
tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros"] }
main.rs:
use sea_orm::tests_cfg::{cake, cake_filling};use sea_orm::{Database,DbErr,EntityTrait,JoinType,QuerySelect,RelationTrait};#[tokio::main]asyncfnmain() -> Result<(),DbErr>{let db = Database::connect("sqlite::memory:").await?;
tokio::spawn(asyncmove{let _cakes = cake::Entity::find().join_rev(JoinType::InnerJoin, cake_filling::Relation::Cake.def()).all(&db).await.unwrap();}).await.unwrap();Ok(())}
Possible solution is to make the field on_condition in RelationDef Send by just adding + Send to it. It shouldn't be a big constraint in my opinion as most of the types are Send, but also it is a breaking change.
The text was updated successfully, but these errors were encountered:
Description
The type
RelationDef
is not Send, which broke a lot of code in multithreaded environments, because async runtimes needs Futures which implementSend
.Steps to Reproduce
Compile example code below
Expected Behavior
Should compile
Actual Behavior
It doesn't compiles, because
tokio::spawn
expects a Future that isSend
.Reproduces How Often
always
Versions
sea-orm: v0.9.0
database: sqlite (but it happens with all of them)
OS: Arch Linux kernel 5.18.10
Additional Information
Example code that compiles on sea-orm v0.8.0, but not on v0.9.0
Cargo.toml:
main.rs:
Possible solution is to make the field
on_condition
inRelationDef
Send by just adding+ Send
to it. It shouldn't be a big constraint in my opinion as most of the types are Send, but also it is a breaking change.The text was updated successfully, but these errors were encountered: