Heroku large file stream fails after 30 seconds

I have a working python website that streams a file as requested by the client. After 30 seconds, the connection is terminated using Heroku. I use web.py and get new output. According to Heroku docs:

Cedar supports HTTP 1.1 features such as long polling and streaming responses. The application has an initial 30 second window to respond one byte back to the client. However, each byte transmitted after that (either received from the client or sent by your application) resets the minimized 55-second window. If no data is sent within 55 seconds, the connection will end.

I send much more than 1 byte every 55 seconds, but the connection still terminates.

These are the headers I use

 web.header('Content-type' , 'application/zip') web.header('Content-Disposition', 'attachment; filename="images.zip"') 

I even tried to add:

 web.header('Transfer-Encoding','chunked') 

Am I doing something wrong?

+4
source share
1 answer

It seems that the problem was caused by poor gunicorn settings. The gunicron timeout gunicron in Procfile did the trick:

 --timeout 300 
+4
source

Source: https://habr.com/ru/post/1491062/


All Articles