In my application, there's a point where a user will initiate an action
that will take a LONG time to complete. (Among other things, it needs
to dynamically gather data from a number of external sources.) Rather
than simply leaving the user hanging while waiting for a response, I'd
like to give feedback at various steps during the process.
My first instinct is to spawn a thread to run the process, and use a
carefully managed interface to provide updates. But I suspect that may
not work the way I expect -- it really depends on the lifecycle of
ActionPack transactions, no? (For example, would I need do a join
somewhere to keep the owning process alive long enough for the thread to
Regardless, this must be design problem that's been solved several times
over. What's considered best practices in Rails, and where can I learn
more about how to implement it?
[*] OTOH, I'm experienced in multi-threaded design, just not in RoR.