[Backgroundrb-devel] Recommendations for eternally-running backgroundrb workers?

Eden Li eden at mojiti.com
Tue May 22 06:32:46 EDT 2007

Can't you remove the periodic checker code that wraps the actual
worker and let backgroundrb scheduler do the periodic thing for you?
In other words, why do you have do_work run "in an infinite loop, ...
periodically to look for work" when essentially that's what
backgroundrb does for you?

On 5/22/07, Jack Nutting <jnutting at gmail.com> wrote:
> I've got some workers that I want to have running all the time.  Right
> now I'm just launching them manually, by requesting a special page in
> my rails app that includes lines like:
>       MiddleMan.new_worker(:class=> :receiver, :job_key=>:r,
> :args=>{:sleep_time=>10})
> This strikes me as a really weak way to fire up my workers.  I
> basically want to automate things so that these will be started by a
> script in /etc/rc?.d.  It seems like using the backgroundrb scheduler
> is not a possibility, since do_work never returns from my workers
> (each of them runs in an infinite loop, polling the database
> periodically to look for work).  So it looks like I need another
> startup script, running after the rest of the system is up, that does
> one of these things:
> - use curl or wget to hit my special worker-starting page (how lame is that?)
> - pipe my MiddleMan.new_worker calls into a "script/backgroundrb
> console" or just "script/console" session (is that any better?)
> As you can see, neither of these options seems very appealing to me.
> I can't be the first person to do this...  How are others handling
> this?
> --
> // jack
> // http://www.nuthole.com
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel

More information about the Backgroundrb-devel mailing list