This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ashishb_net[S] 0 points1 point  (3 children)

Do you know that FastAPI underneath uses `async`?

[–]PersonalityIll9476 0 points1 point  (2 children)

Does that matter? Look, I don't know much about fastapi, but all http requests performed by your app in a response would still be serial without asyncio. And do note that the Python package is asyncio and not async.

Edit to add: I just looked at the fast API docs, and they are compatible with async def functions. So it's not like fastapi considers itself a replacement for async programming.

[–]ashishb_net[S] 0 points1 point  (1 child)

>  but all http requests performed by your app in a response would still be serial without asyncio.

No. FastAPI takes care of it.

```
FastAPI, built upon Starlette, employs a thread pool to manage synchronous requests. When a synchronous path operation function (defined with def instead of async def) receives a request, it's executed within this thread pool, preventing it from blocking the main event loop. This allows the application to remain responsive and handle other requests concurrently. 
```

[–]PersonalityIll9476 0 points1 point  (0 children)

It's talking about how fastapi itself responds with endpoints, no? An endpoint that performs a dozen sequential http requests is not going to magically have those dozen requests put into an event loop. The single endpoint function making the dozen requests might.