How to adjust timeout for python app served with waitress

Viewed 730

I am running a flask application which has an option in the UI where the user can click a button and it calls an endpoint to perform some analysis.

The application is served as follows:

from waitress import serve
serve(app, host="0.0.0.0", port=5000)

After around ~1 minute, I am receiving a gateway timeout in the UI: 504 Gatway Time-out

However, the flask application keeps doing the work behind and after 2 minutes it completes the processing and I can see that it submits the data on the db side. So the process is not timing out itself.

I tried already passing channel_timeout argument to a much higher value (default seems 120 seconds) but with no luck. I know that this makes sense to implement in a different way where the user doesn't have to wait for these two minutes, but I am looking if there is such a timeout set by default and whether it can be increased.

The application is deployed in K8s and the UI is exposed via ingress. Could the timeout come from ingress instead?

1 Answers

The problem was with the ingress controller default timeout.

I managed to get around this issue by changing the implementation and having this job run as background task instead.

Related