I have a Rails application that unfortunately after a request to a controller, has to do some crunching that takes awhile. What are the best practices in Rails for providin
I recommend using Resque gem with it's resque-status plug-in for your heavy background processes.
Resque is a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.
resque-status is an extension to the resque queue system that provides simple trackable jobs.
Once you run a job on a Resque worker using resque-status extension, you will be able to get info about your ongoing progresses and ability to kill a specific process very easily. See examples:
status.pct_complete #=> 0
status.status #=> 'queued'
status.queued? #=> true
status.working? #=> false
status.time #=> Time object
status.message #=> "Created at ..."
Also resque and resque-status has a cool web interface to interact with your jobs which is so cool.