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
This code gives me a thread safety error when I run it.
`Rc<RefCell<actix_session::session::SessionInner>>` cannot be shared between threads safely
within `MyCtx`, the trait `Sync` is not implemented for `Rc<RefCell<actix_session::session::SessionInner>>`
I know the session store can also be accessed from a HttpRequest object but that also returns the same error.
Is there a workaround or an example of this being done?
The text was updated successfully, but these errors were encountered:
@forty1thousand actix uses a bunch of single-threaded tokio runtimes instead of a single multi-threaded to avoid overhead of work stealing, so many types are !Send. Due to limitations in Rust type system we can't be transparent over Send and Sync, but here it actually should be ok to use SendWrapper, which moves Send check into a runtime.
@forty1thousand I'm closing this as @ilslv gave the working solution, which we do use in our production without problem. Feel free to re-open if there are further questions.
I have a project going where I need to store state inside of a session object and need to access it from inside of both a query and mutation resolver.
Here is a simple version of my current code.
graphql.rs
endpoints.rs
This code gives me a thread safety error when I run it.
I know the session store can also be accessed from a
HttpRequest
object but that also returns the same error.Is there a workaround or an example of this being done?
The text was updated successfully, but these errors were encountered: