[Backgroundrb-devel] BackgrounDRb newbie stuck at first base. Fresh pair of eyes needed

Chris T ctmailinglists at googlemail.com
Thu Oct 12 11:18:59 EDT 2006

Can't believe I can't see the problem here, but after a few hours 
bashing my head on a brick wall, going to risk looking stupid by seeing 
if anyone can point out my idiocy (that's the worst thing about coding 
on your own).

Trying to get BackgrounDRb to take over the scraping task which is 
currently being done in a Rails controller. That's not the problem at 
the moment, as I can't even get past first base. For some reason, it 
doesn't seem to be setting up my worker class properly.

Here's my worker class def:

    |class ScrapeWorker < BackgrounDRb::Rails
      attr_accessor :progress, :message, :ids_retrieved
      def do_work(args)
        @progress = 0
        @message = args[:message] || ""
        @job_completed = false
        @hse_notices_retrieved = 0
        puts args[:message]

      def get_new_ids(args)

However, I get NoMethodError (undefined method `ids_retrieved' for 

Set up a quick unit test, and not surprisingly fails on first respond_to

    |  def test_should_respond_to_progress_message_and_hse_notices_retrieved
        MiddleMan.new_worker(:class => :scrape_worker, :args  =>
    {:message => "Uh -Oh"}, :job_key => :test_scraper, :ttl => 5)
        s = MiddleMan[:test_scraper]
        assert s.respond_to?(:progress)
        assert s.respond_to?(:message)
        assert s.respond_to?(:hse_notices_retrieved)
        assert_equal "Uh -Oh", s.message

I'm sure it must be something really obviously but can't for the life of 
me work out what. Any ideas?

Thanks in advance

p.s. I'm on OS X, though not sure that's relevant here...

More information about the Backgroundrb-devel mailing list