[Backgroundrb-devel] Autostarting and job keys...

Brett Walker lapomme00 at gmail.com
Mon Aug 7 10:24:42 EDT 2006

I think I've got it figured out.  Turns out I was mucking with the
plugin's start.rake instead of the one in scripts/backgroundrb.  My
idea seems to work.

In the 2 places where this line exits

BackgrounDRb::MiddleMan.new(CONFIG['timer_sleep'] || 60))

replace with

      middle_man = BackgrounDRb::MiddleMan.new(CONFIG['timer_sleep'] || 60)

This keeps the middle man that was created and attached to the DRb
service.  Now we pass that into Auto.start


and use it to autostart the jobs

  def self.start(middle_man)
      middle_man.new_worker(:class => entry['class'],
                         :args => entry['args'],
                         :job_key => key)

This gives me access to the jobs via the MiddleMan in my application.

Does this seem safe and a valid fix?


On 8/7/06, Brett Walker <lapomme00 at gmail.com> wrote:
> I've now got 5 processes auto started.  But I when I query the
> MiddleMan for their keys (in script/console), it doesn't find them.
> Looking at the start script, it looks like it might be creating a new
> MiddleMan object for each autostart
>       BackgrounDRb::MiddleMan.new.new_worker(:class => entry['class'],
> Even changing it to
>      BackgrounDRb::MiddleMan.new_worker(:class => entry['class'],
> didn't seem to take care of it.  I even tried to create a single
> MiddleMan and pass that to autostart, still to no avail.
> Is there a way to have the autostarted jobs be manages by the main
> MiddleMan object?
> Cheers,
> Brett

More information about the Backgroundrb-devel mailing list