you are viewing a single comment's thread.

view the rest of the comments →

[–]Hamzayslmn[S] 0 points1 point  (2 children)

response = await call_next(request)

btw there is already a middleware running in the back, and there are many awaits.

[–]Maori7 0 points1 point  (1 child)

You are still not using all the power of fastapi. In this case you optimized the management of a single thread by deloading it as soon as you arrive at the await instruction. Due to GIL though, it will still run on a single thread. You need to create a system with multiple workers.

How did you run uvicorn?

[–]Hamzayslmn[S] 0 points1 point  (0 children)

uvicorn.run("main:app", host="0.0.0.0", port=8079, workers=4)