-
-
Notifications
You must be signed in to change notification settings - Fork 325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error(BlockingClientInFutureContext,
when using api from within actix handler
#63
Comments
Interesting! I guess this makes sense because the actix routes are futures in 1.0 ? It makes sense that you would get this; I would look into moving |
So in my actual program, I am calling a https://docs.rs/rusoto/ call and that goes through fine. Looking at the code it looks like they are also using reqwest. But it looks like they do wrap each call with Would you happen to have an example code for wrapping something like |
@clux Most of the ecosystem necessary to do this (reqwest, tokio, etc.) have builds that support a fully future (async/await) interface. It would be amazing for this client to support:
|
It's certainly something we want to do. But I'm not going to try this until async / await syntax reaches stable in 1.39. Happy to take PRs for it in the mean time though! |
Do we have any way to work around it? |
basic async/await support now in a proper streaming watch api is still TODO, so while it's not functionally giving a big performance improvement, it's at least a step in the right direction and it should be useable within async contexts. For the performance win, please take discussions on a proper streaming API to #83. |
cool! |
Minimal code that causes this error is here, https://gist.github.com/vigneshsarma/426074f7e5bf76518be302bc4d8ff4ca
I am running on macos and kubernetes server is minikube and version:
Sample run:
invoke the endpoint by calling
curl http://localhost:6666/foo/
.Full stacktrace is in the gist.
As you can see the
ls_jobs
call works outside the actix web server context, while the exact same call fails inside.Any idea what might be wrong?
The text was updated successfully, but these errors were encountered: