[Backgroundrb-devel] Getting results from a dead worker. example?

Tomasz Kaye tomasz at resourcestudio.nl
Tue Jan 23 06:19:24 EST 2007


I'm having a little difficulty understanding how to retrieve results  
from deceased workers (from the documentation it seems that it is  
possible to do this).

I pasted my simple test below. If anyone could point out what i  
should be doing differently i'd be very grateful.

My test worker:

class TestWorker < BackgrounDRb::Worker::RailsBase
   def do_work(args)
     results[:done_with_do_work] = true
     self.delete
   end
end
TestWorker.register

My rake task:

task :tester => :environment do
   k=MiddleMan.new_worker(
   :class => :test_worker
   )
   sleep 1 # the worker will die during this pause
# next line gives a nil object error
puts "done_with_do_work=#{MiddleMan.worker(k).results 
[:done_with_do_work]||"not available"}"
end


More information about the Backgroundrb-devel mailing list