-
Hey there! I'm experiencing a strange issue when running actors alongside actix-web within a
The issue seems a bit beyond me to diagnose, but I'm guessing that the
I'm wondering mainly if this is a legit issue, since I can't turn up any similar problems that don't amount to PEBCAK. Is this a legit problem with trying to use these 2 systems at once? Am I doing something wrong here? If they're just incompatible, that's unfortunate, but I'll figure out how to work around it, because IMO Ideally I'm just missing something obvious, though, that y'all know about? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
You can probably start your actor from within the closure passed to |
Beta Was this translation helpful? Give feedback.
-
@abonander I'm getting the same error in my tests but I am not using actors. Some of my API endpoints are sending get requests using |
Beta Was this translation helpful? Give feedback.
#[sqlx::test]
doesn't start anactix_rt::System
. Theruntime-actix
features were changed to aliases of theruntime-tokio
features, actually by a PR from @robjtede in #1679, because actix-web is meant to be fully compatible with Tokio now.You can probably start your actor from within the closure passed to
HttpServer::new()
as I'd expect that to be run on each worker thread when it starts. If you only want it to be run once you could protect that with astd::sync::Once
or a simpleAtomicBool
in astatic
.