Hi guys,
I'm feeling a little bit like a small fish in a really big ocean, and would appreciate some hand holding.
Actix-web is currently working great where we reach an endpoint, we do something, we .await
it and then return the result.
The problem is this: Sometimes a user may reach an end-point that requires us do some CPU heavy work that can take a long time. We don't want to .await
here. We want to pass it off somewhere and be able to immediately return, perhaps with a job-id so that the client can now poll a different endpoint to check on how far it is until completion. I've looked around and have found crates like background_jobs
which need to live inside of a semaphore
(what the...?) or actix_web::rt::task::spawn_blocking
which from the description sounds like what i need, but how do integrate that into actix-web? also futures_cpupool
but the same problem as the one before.
Again, I'm kind of lost here. Can anyone guide me? This must be a very common pattern