The only thing I've come up with so far is to break the import process
into multiple steps, call each step using an ajax request from a page
and use rjs templates in responses to add feedback messages (importing
customer 'Mark Woods' etc.) into the calling page. Sounds like an awful
lot of trouble compared to flushing an output buffer in coldfusion, php
etc. Anyone got any other suggestions?
Mark
Right now, I'd say backgroundrb is probably the best library to use
(although there are certainly plenty to pick from). Spawn
(http://rubyforge.org/projects/spawn) might also be worth a look.
/dh
Obviously, in general long running requests are a bad idea, but these
are import scripts that are manually run once a month in a system that
currently has 6 users and isn't likely to ever have more than 20 (and
I'm thinking a good few years down the line there). The system also runs
on a dedicated server in the client's office. A long running process
wouldn't be a big deal here if the user was getting constant feedback.
However, backgrounding the job and having the web interface monitor it
is a nice approach and I'll look into that. Thanks for all the replies.
Mark
> You can stream output in a non blocking manner by writing a custom
> mongrel handler.
We are using mongrel, but hadn't planned to tie the app to it. Using a
custom mongrel handler is an appealing option though. The background
process is a nice idea, but at this stage we need something quick and
easy (we're building a functioning prototype at the moment and we don't
know exactly how things will pan out in the end). We'd even thought
about just throwing in a php script to handle the import for the moment,
but keeping it in ruby would be preferable.
Thanks
Mark