I installed BackgrounDRB as instructed:
script/plugin install svn://rubyforge.org//var/svn/backgroundrb
rake backgroundrb:setup
I started it with:
rake backgroundrb:start
In a model I make the call:
MiddleMan.new_worker :class => :rss_worker
In /lib/workers I have file rss_worker.rb, which contains the class:
Class RssWorker < BackgrounDRb::Rails
def do_work(args)
…
end
end
It seems like I have everything setup right, but I get the following
NameError:
uninitialized constant RssWorker
Any ideas? It’s probably something dumb, but I can’t seem to figure it
out.
On Jul 25, 2006, at 6:57 PM, justin Pease wrote:
MiddleMan.new_worker :class => :rss_worker
It seems like I have everything setup right, but I get the following
NameError:
uninitialized constant RssWorker
Any ideas? It’s probably something dumb, but I can’t seem to
figure it
out.
Hey Justin-
Have you restarted the rb server since you put your worker class in
the lib dir? You have to restart the drb server to pick up new files
you put in lib/workers. Oh actually now that I look at your code
again I see that you have misspelled class as Class. Is this just a
typo or is this also in your worker class code?
Class RssWorker < BackgrounDRb::Rails
should be
class RssWorker < BackgrounDRb::Rails
-Ezra
Ezra Z. wrote:
Have you restarted the rb server since you put your worker class in
the lib dir?
I restarted webrick and also issued the commands
rake backgroundrb:stop
rake backgroundrb:start
again I see that you have misspelled class as Class. Is this just a
typo or is this also in your worker class code?
Woops. Yes, that is just a typo in the post. It is “class” in the
code.
–
Justin
Ok. I had used:
rake backgroundrb:stop
and CTRL-C to kill my webrick.
Did this a bunch of times. Then I thought to check Activity Monitor -
and sure enough, two Ruby instances were still alive! So I hand killed
these, restarted everything - and the error went away.
I have a similar problem trying to get BackgroundRb to work - the error
message I get is
undefined method ‘start process’ for nil:NilClass
My install went ok but strangely this command didn’t work
script/backgroundrb/start -p 11111 -d
I get the error
start: invalid option: -p
So instead i’ve done
script/backgroundrb/start -d
which seems ok but when my controller calls my worker I get
undefined method ‘start process’ for nil:NilClass