Skip to content
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

[Question] No async endpoints in full-stack-fastapi-postgresql app? #55

Closed
sagrawal-idrc opened this issue Aug 30, 2019 · 2 comments
Closed

Comments

@sagrawal-idrc
Copy link

sagrawal-idrc commented Aug 30, 2019

I see that the api endpoints do not have async handlers. Doesn't this mean that these handlers will run synchronously and won't be able to take advantage of the event loop/ async capabilities as NodeJS does?

There might be some gap in my understanding here. If yes, kindly point me to relevant source. Thanks.

@sagrawal-idrc sagrawal-idrc changed the title No async endpoints in full-stack-fastapi-postgresql app? [Question] No async endpoints in full-stack-fastapi-postgresql app? Aug 30, 2019
@sagrawal-idrc
Copy link
Author

I read here now (under Very Technical Details) on https://fastapi.tiangolo.com/async/:

When you declare a path operation function with normal def instead of async def, it is run in an external threadpool that is then awaited, instead of being called directly (as it would block the server).

I think this answers my question and I will close the issue.

@tiangolo
Copy link
Owner

tiangolo commented Sep 1, 2019

That's right. Thanks for reporting back and closing the issue. 🍰🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants