I have a python web worker that streams a large file upon client request. After 30 seconds the connection is terminated by Heroku. I'm using web.py
and yielding new output. According to Heroku docs:
Cedar supports HTTP 1.1 features such as long-polling and streaming responses. An application has an initial 30 second window to respond with a single byte back to the client. However, each byte transmitted thereafter (either received from the client or sent by your application) resets a rolling 55 second window. If no data is sent during the 55 second window, the connection will be terminated.
I send much more than 1 byte every 55 seconds but the connection is still terminated.
These are the headers I'm using
web.header('Content-type' , 'application/zip')
web.header('Content-Disposition', 'attachment; filename="images.zip"')
I even tried adding:
web.header('Transfer-Encoding','chunked')
Am I doing something wrong?
It appears the problem was a result of bad
gunicorn
settings. Extendinggunicron
timeout inProcfile
did the trick: