[Backgroundrb-devel] Multiple copies of same worker

hemant gethemant at gmail.com
Sun Dec 23 10:40:31 EST 2007


Hi
On Dec 17, 2007 8:40 PM, Danila Ulyanov <du at bestwaytech.com> wrote:
> Is there any special reason that creating worker does not return a
> unique job_key itself upon creation like it used to in the old
> backgroundrb? :-)

It does return that now.

>
> Would there be much overhead creating/destroying up to 8 workers versus
> having 8 workers running continuously and just reusing them?
>
> Thanks!
>
>
> hemant wrote:
> > Hi
> >
> >> On Dec 17, 2007 3:40 PM, Danila Ulyanov <du at bestwaytech.com> wrote:
> >>> Hello!
> >>>
> >>> I remember there was a thread sometime last month about multiple copies
> >>> of the same worker. Is that still impossible to do?
> >>>
> >>> What I am trying to accomplish is to limit number of concurrent
> >>> connections for a lengthy search. I used to put search requests in a
> >>> queue, then as slots freed up, they spawned off a new copy of the
> >>> "search worker" which killed itself upon completion. That way no more
> >>> than 8 searches were conducted at the same time.
> >>>
> >>> Will it be possible to do this in the new version or is there an
> >>> alternative solution to this problem?
> >>>
> >
> > Yes, you can have multiple copies of same worker running. But there
> > are two catches:
> >
> > 1. You have to specify a unique job_key for each worker, when you are
> > making a call to a start worker.
> > 2. To start a worker, you will have to use
> > MiddleMan.new_worker(:worker => :foo_worker, :job_key => "whoa_man")
> >
> > To exit a worker, once its done with search, simply call "exit" on them.
> >
> >
>



-- 
Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org


More information about the Backgroundrb-devel mailing list