In my app, I store the job key when a worker is fired off and then
check back in periodically to see how its doing. The workers delete
themselves when they're done. I would expect when I try to get a
worker that has been deleted, I would get nil or a proper exception,
but instead I get:
>> MiddleMan.worker('foobar')
NoMethodError: undefined method `object' for nil:NilClass
from (drbunix:///tmp/backgroundrbunix_localhost_2000) /Users/
brandon/projects/backgroundrb/vendor/plugins/backgroundrb/server/lib/
backgroundrb/middleman.rb:396:in `worker'
I've modified MiddleMan#worker to return nil if the job doesn't exist:
def worker(key)
worker = ex { @jobs[key].object if @jobs[key] }
WorkerProxy.new(worker) unless worker.nil?
end
What do you think?
Brandon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
Url : http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20070426/862fca55/attachment.bin