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
error: generator cannot be shared between threads safely
--> src/main.rs:105:21
|
105 | / Box::pin(async move {
106 | | job().await;
107 | | })
| |______________________^ future created by async block is not `Sync`
|
= help: the trait `Sync` is not implemented for `dyn Future<Output = Result<Type, deadpool_postgres::tokio_postgres::Error>> + Send`
= note: required for the cast to the object type `dyn Future<Output = ()> + Send + Sync`
error: generator cannot be shared between threads safely
--> src/main.rs:105:21
|
105 | / Box::pin(async move {
106 | | job().await;
107 | | })
| |______________________^ future created by async block is not `Sync`
|
= help: the trait `Sync` is not implemented for `dyn Future<Output = Result<Statement, deadpool_postgres::tokio_postgres::Error>> + Send`
= note: required for the cast to the object type `dyn Future<Output = ()> + Send + Sync`
Can't seem to find the error in my ways here. Appreciate any help.
The text was updated successfully, but these errors were encountered:
So - root cause. The future you're trying to await on can't be sent between threads (there's no Sync trait implemented on the value). This is to do with the API you're trying to put inside of the async parts.
That is unfortunately out of the scope of this crate.
It was encountered with other people earlier #8 so have look.
Basically - their suggestion is to have an MPSC Sender that's moved to the scheduler job, and a receiver that runs in current thread / another thread that waits for values from the MSPC.
Give an async function called
task
the following code seems like it should work:Yet I see the error
Can't seem to find the error in my ways here. Appreciate any help.
The text was updated successfully, but these errors were encountered: