Hi.

I've been trying to use BackgrounDRb for a couple of weeks now and have
been experiencing some very odd behaviour, (largely due to Rails'
behaviour in the face of threads but also) due to my misunderstanding
BackgrounDRb.

Given the following example (from the rdoc), creating a new worker calls
the do_work method, which is ran in a new process and hence doesn't
block. Later calling the other_method on the worker DOES block.

key = MiddleMan.new_worker(:class => :example_worker) <-- This doesn't
block.
worker = MiddleMan.worker(key)
worker.other_method <-- This blocks.
worker.delete

1. Is that the correct behaviour? I had assumed that other_method
wouldn't block.
2. Is there any way of re-calling the do_work method, or any other
methods, in a way which doesn't block? If you just call do_work, it
blocks.

Thanks.

Steph

P.S. The only way I have found to do this is via the scheduler, like so.

    MiddleMan.schedule_worker(
      :class => :example_worker,
      :job_key => :schedule_test,
      :worker_method => :arg_method,
      :worker_method_args => { :arg => "whatever", :another_arg =>
"whatever else" },
      :trigger_args => {
        :start => Time.now + 5.seconds
      }
    )

The problem is that it creates a new worker, which defeats the point of
what I'm trying to do.
-- 
Posted via http://www.ruby-forum.com/.