I'm trying to stream data from a flask/gunicorn server:
while (True):
result = json.dumps(tweetQueue.get())
yield result
However, 30 seconds into the stream, gunicorn times out my connection and stops the stream. How can I make the timeout such that publishing new data to the stream from the server will restart the timeout so the stream will not be terminated?
Thanks!
I am answering my own question after doing some more research.
gunicorn server:app -k gevent
This uses asynchronous workers, which have the benefit of using Connection: keep-alive
when serving requests. This allows the request to be served indefinitely.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With