Our great sponsors
-
heroku_streaming_csv
Sample application with ActionController::Live with slow generation of CSV file for surpasing Heroku's timeout
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Rails seems to have streaming functionality to handle this kind of output generation in the ActionController::Live. Also in Rails edge (future v7) there is a #send_stream method that seems to achieve this functionality so I copied it to my Rails 5.2 app into a controller concern and changed the CSV generation logic to implement the Enumerable #each method. It was not working until I also override the Last-Modified header. See this issue discussion.
I have deployed this app in a Heroku app and the code is on this github repo.