I have UI updates that can be rather long depending. For example, the user may pick some option and I would want to plot something, but that may take a lot of time.
Is there some way to have a timeout for them (and then display an error or previous state) or even have an option for the user to cancel themselves?
You can set timeouts on the flask or WSGI server (e.g. gunicorn) level. If an exception occurs during the processing of a callback, then the output will not be updated, implicitly showing the ‘previous state’.
As far as I’m aware, there isn’t a way to cancel running requests using something like gunicorn.
Can you explain how to add a timeout for flask or gunicorn to prevent 504 gateway timeout error? I run into this error when the downloading task takes 2 min to complete. I tried adding --timeout 300 to Procfile. But it doesn’t seem to work.