[Backgroundrb-devel] Getting started
gethemant at gmail.com
Fri Feb 15 12:58:33 EST 2008
On Fri, Feb 15, 2008 at 7:11 AM, Richard Everhart
<rich.everhart at gmail.com> wrote:
> Changing 'class' to 'worker' in new_worker seemed to get things going.
> I can see that after new_worker is called the worker's create method
> is then called. This only seems to work once. After the first time, I
> get the following error:
> You have a nil object when you didn't expect it!
> The error occurred while evaluating nil.send_request
> Eventually, what I would really like to do is return a value back to
> the browser. send_request is documented to do this but the browser
> just hangs and I really can't tell if the the worker method (do_work
> in this is being executed). While the work is being executed by the
> worker I'd like to display a progress bar or a busy indicator, both of
> which I've seen examples. But, it seems that the do_work method is
> never called, even when calling ask_work, which is not supposed to
> I have not tried out the latest version so I'm not sure if that will
> change things. Thanks a lot!
I wanted to ask, are you sure you want to create new workers on each
request? Can't you handle all the requests in the same instance of
worker. Also, send_request blocks until bdrb returns a response and
thats why your browser is hung.
A better approach is to use register_status in your worker and invoke
ask_status in rails code. Again, please read the README carefully from
start to beginning.
Also, use following links for debugging:
More information about the Backgroundrb-devel