[Backgroundrb-devel] best approach to managing workers and getting status

Jack Nutting jnutting at gmail.com
Mon May 5 12:33:47 EDT 2008

On Mon, May 5, 2008 at 4:25 PM, Sean O'Hara <sohara at sohara.com> wrote:
> Hi Jack,
>  That approach sounds very good, and makes a lot of sense for this kind of
> job. Although, it doesn't give me the satisfaction of watching the ajax
> progress bar :)
>  But could we do for a background job that really does require providing
> feedback to the user, such as processing a credit card transaction for an
> order in real time. I would like to offload the job to backgroundrb so that
> the user is getting some feedback, and isn't tempted to submit the order
> twice out of impatience, but I also don't want extra workers hanging around,
> or to be incurring the extra memory usage associated with starting them up.
> Is there a way to have a single worker act as the transaction processor, but
> still be able to give back the status of unique jobs to rails?

How about an extension of the approach I mentioned earlier:  Instead
of just a simple boolean "pending" flag, you could have a field of any
kind you like:  An integer or a float to indicate percentage complete,
or a string for arbitrary text.  Then, while your backgroundrb worker
is doing its thing, it can update the field with the current status
(percentage complete, or "authenticating card number..." etc), and
your ajax method could grab that from the database instead of asking
the worker for it.

// jack
// http://www.nuthole.com

More information about the Backgroundrb-devel mailing list