[Backgroundrb-devel] A couple of problems
Chris Roos
chrisjroos at gmail.com
Wed Jul 19 05:53:16 EDT 2006
Hi Ezra,
Thanks for the great work on BackgrounDRb. I have come across a
couple of problems.
1. I wanted to define a simple class in the worker file to wrap up and
pass back some data to my controller. It seems that if I create the
class either inside or outside of my worker class (in the same file)
it gets wrapper by a DRb::DRbUknown object and therefore cannot be
accessed from my controller.
class MyWorker < BackgrounDRb::Rails
class MyResult
attr_reader :result
def initialize(result)
@result = result
end
end
def do_work()
end
def results
MyResult.new(100)
end
end
-- my_controller.rb --
def results
results = MiddleMan.get_worker(session[:job_key]).results
p results.result
#=> undefined method `result' for #<DRb::DRbUnknown:0x26d15a4>
end
I got around this by defining the class within the results method and
returning like that. Really just wondering if this is by design or a
bug?
2. When trying to pass a constant (class name in this instance) in the
args hash I receive the following error.
#=> undefined method `[]' for #<DRb::DRbUnknown:0x13382d4>
(druby://localhost:22222)
/rails_app/vendor/plugins/backgroundrb/backgroundrb.rb:105:in
`new_worker'
(druby://localhost:22222)
/rails_app/vendor/plugins/backgroundrb/backgroundrb.rb:104:in
`synchronize'
(druby://localhost:22222)
/rails_app/vendor/plugins/backgroundrb/backgroundrb.rb:104:in
`new_worker'
app/controllers/feed_controller.rb:36:in `method_calling_drb_worker'
Again, I wonder if this is by design or a bug?
Cheers,
Chris
More information about the Backgroundrb-devel
mailing list