Have a few cases where it is critically important to flush the output of ‘render’ immediately. For example:
def place_order if validate_and_record_order? render :text => “OK" else render :text => “ERROR" end # DESPERATELY WANT TO FLUSH OUTPUT HERE! # Do lots of talking with banks, send out mailers, etc. end Another wrinkle here is we can’t store the customer’s banking information to run as a deferred task. Ideally we just want to say ‘flush the output’ after the ‘if’ block. Even if there’s an exception after the ‘if’ we still don’t want them to get a 500, we want them to get the OK/ERROR. The problem we have is the people connecting to our app are sometimes timing out (they have a short timeout) and think the order failed when in fact it was recorded, customer was charged, etc. I’m a little hesitant about using Thread.new, but perhaps that’s the only reasonable way to flush the output early? btw- This is Rails 4.0.x, Apache+Passenger. Thanks! Phil -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9648B541-87C6-4D03-AFC4-C0177A3B26A9%40gmail.com. For more options, visit https://groups.google.com/d/optout.