[Ruby] Tracking messages & progress
Philip Hallstrom
philip at pjkh.com
Fri May 23 13:33:56 PDT 2008
> I am using rails to provide a web interface to deploying some test sandboxes
> on a windows machine.
>
> The application does a chain of admins tasks: My first cut at this was just
> piping all output to StringIO and then when the task completes displaying
> it.
>
> This is not very pleasing as the browser hangs for a while with no feedback.
> What I'd like is to stream the messages as they come while still keeping the
> browser locked.
>
> What would be the best approach to this:
>
>
>
> . Spawning the task and doing a periodic_remote_call to monitor the
> log (though not sure how to lock the browser in this case)
>
> . Action chunking: Chunk the big process into smaller ones that each
> updates the page with the message and then calls the next one in the chain -
> seems like lots of work and brittle.
Why do you need to lock the browser? Why not spawn the task off in
backgroundrb (or something) and set it up to report it's status somewhere
and then set the browser to refresh periodically to see what's going on.
If the user leaves, just make it so they can come back and pick up at that
point... maybe send an email on completion for those that don't want to
wait around.
-philip
More information about the Ruby
mailing list