HTTP streaming to Heroku (loading lots of data)
I have one application hosted on Heroku and this application saves a lot of data information to the database (it takes about 70 seconds).
Heroku renders an H12 error page about timeout after 30 seconds of each request , how can I display some informational message during boot instead of displaying an H12 error ?
I was looking for an example of this, but I was not very successful ... I just found some notes that I have to send every time (for example 15 seconds) some control line from the server, but I have not found a specific example already how to do this ...
Any advice on how to do this?
Thanks in advance.
source to share
It is bad practice for your users to wait 70 seconds for a request on any platform. Heroku simply applies this best practice by implementing a 30 second timeout. So the real question is how best to archive the application.
Heroku has an article on implementing background workers that are designed to solve this very problem: https://devcenter.heroku.com/articles/queueing
The basic approach is to have the web request schedule do a background job (using Delayed Job, Queue Classic, Resque, etc.) and respond immediately to the user with some progress bar. Then running the desktop dynamically does the heavy lifting of saving the information to the db. When this happens, it flips some flag in the db or some other storage engine that notifies the web client when the job is complete.
Running a background worker requires a different dyno. If you want to avoid this expense, you can check out Friday Girl , which many report success.
Hope it helps.
source to share