Note that there are some explanatory texts on larger screens.

plurals
  1. POHeroku, H12 and passthrough upload timeouts
    text
    copied!<p><strong>Overview:</strong></p> <p>I have a photobooth that takes pictures and sends them to my web application. Then my web application store users data and sends the picture to user facebook profile/fanpage.</p> <p>My web app runs <strong>Ruby on Rails @ Heroku</strong> Cedar stack.</p> <p><strong>Flow:</strong></p> <ol> <li>My webapp receives the photo from the photobooth via a POST, like an web form. </li> <li>The booth waits for the server response. If the upload has failed, it will send the picture again.</li> <li>The response from webapp only will be fired after facebook upload has been completed.</li> </ol> <p><strong>Problems:</strong></p> <p>Webapp only sends data to photobooth after all processing has been completed. Many times this will happen after 30 secs. This causes to Heroku fire an H12 - Timeout.</p> <p><strong>Solutions?</strong></p> <p><strong>Keep the request alive</strong> while file is being uploaded (return some response data in order to prevent heroku from firing a H12 - <a href="https://devcenter.heroku.com/articles/http-routing#timeouts" rel="nofollow noreferrer">https://devcenter.heroku.com/articles/http-routing#timeouts</a>). - Is it possible? how to achieve this in Ruby?</p> <p><strong>Change to Unicorn + Nginx</strong> and activate Upload Module (this way dyno only receives the request after the upload has been completed - <a href="https://stackoverflow.com/questions/9592664/unicorn-rails-large-uploads">Unicorn + Rails + Large Uploads</a>). Is it really possible?</p> <p><strong>Use the rack-timeout gem</strong>. This would make a lot of my passthrough uploads to fail, so the pictures would never be posted on Facebook, right?</p> <p><strong>Change the architecture.</strong> Make the upload direct to S3, spin a worker to check new pictures uploaded to S3 bucket, download them and send them to Facebook. - <em>This one might be the best one, but it takes a lot of time and effort. I might go for it in the long term, but I'm looking for a fast solution right now.</em></p> <p><strong>Other...</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload