ian at telematter.com
2008-Feb-27 18:17 UTC
[Backgroundrb-devel] multiple instances of workers?
Hi,
I think I am misunderstanding what a ''worker'' is.
Basically I call one up like so in rails:
session[:job_key] = MiddleMan.new_worker(:class => :slicer_worker, :args
=> game.id, :job_key => game.id)
MiddleMan.schedule_worker(
:class => :slicer_worker,
:args => game.id,
:worker_method => :grab_slice,
:job_key => session[:job_key],
:worker_method_args => game.id.to_s, # this HAS to be a string
for reasons beyond my knowledge
:trigger_type => :trigger,
:trigger_args => {
:repeat_interval => 5.seconds
}
)
I can call as many of these as I like and they do what they
are supposed to do (update some information for a game).
However if one of them needs to stop working because it is done
I am supposed to delete it right?
if blah != nil then
....
else
logger.debug(''should be deleting a worker'')
exit
#worker.delete
#MiddleMan.delete_worker(:class => slicer_worker, :job_key => args)
All three of those calls will stop ALL my workers. I just want to stop
the one
that hit that case. The rest can continue on working until they are
done.
Any suggestions?
Thanks,
ian