I have the following code:
import timefrom fastapi import FastAPI, Requestapp = FastAPI()@app.get("/ping")async def ping(request: Request): print("Hello") time.sleep(5) print("bye") return {"ping": "pong!"}
If I run my code on localhost - e.g., http://localhost:8501/ping
- in different tabs of the same browser window, I get:
HellobyeHellobye
instead of:
HelloHellobyebye
I have read about using httpx
, but still, I cannot have a true parallelization. What's the problem?