SD Ruby, My apologies if any of you are Pragmatic Studio alums as I posted this to the railsstudio mailing list as well to try to find a solution.
One of my apps has a task that can run for a good 30-45 seconds and is something the user necessarily has to wait on. In order not to totally block the Rails process I've moved it to a background process using delayed_job. What I can't figure out is how to give the user visual feedback with a progress bar or other indication of how the task is progressing. Delayed_job doesn't offer a status callback, at least not from the most popular fork of the plugin on collectiveidea's github repo. Does anyone here have suggestions on how to mechanize feedback during a DJ run? Originally I tried using backgroundRb based on an example in a book but the current version is quite different from the version used in the example and I couldn't get it to work properly. Also, in the process of searching for solutions to those issues it appeared to me that the Rails community had moved away from backgroundRb and towards delayed_job so I opted for the lemming approach as well. With DJ I tried caching a :percent_complete value but it seems the delayed_job process and Rails don't share the same memory space. The value cached by DJ is always null when read by the Rails controller. Would using the mem_cache store solve that? I'd appreciate some words if anyone else has cracked the code on a good way to push a long-running task out of band but still provide user feedback. Cheers, Chris -- SD Ruby mailing list [email protected] http://groups.google.com/group/sdruby
