I am setting up a timeout check so I made and endpoint:
@app.get("/tc", status_code=200)
def timeout_check():
time.sleep(500)
return "NOT OK"
I am using the docker image tiangolo/uvicorn-gunicorn-fastapi:python3.7
and my command to run the server:
CMD ["gunicorn","--log-level","debug","--keep-alive","15", "--reload", "-b", "0.0.0.0:8080", "--timeout", "15", "--worker-class=uvicorn.workers.UvicornH11Worker", "--workers=10", "myapp.main:app"]
I am expecting the endpoint to fail after 15 seconds, but it doesn't. Seems like the timeout is not respected. Any fix for that?
Async workers behave differently from sync workers:
There is no request timeout parameter for uvicorn right now.
for more details: https://github.com/benoitc/gunicorn/issues/1493