managing a lengthy process with periodic page updates

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?


- ff

[*] OTOH, I'm experienced in multi-threaded design, just not in RoR.

Look at something like delayed_job..


Or Nanite combined with Redis for the progress feedback.

Also, instead of using a periodical updater you could look into a push server (and event-based server like Node.js to send the events on the server, some websockets+fallback script on the client side).

Best regards

Peter De Berdt