[Backgroundrb-devel] Best way to start a worker
Ezra Zygmuntowicz
ezmobius at gmail.com
Thu Apr 5 21:43:16 EDT 2007
Jim-
For a worker like that it shoudl just run all the time in a loop.
Have it sleep for x second s and then wake up and process the queue,
then sleep again. etc..
Cheers-
-Ezra
On Apr 5, 2007, at 5:57 PM, Jim Scott wrote:
> I have installed backgroundrb. I can start it. I have read
> everything I can get my hands on, and have read the list for a few
> months. I have written a worker, and am ready to start.
>
>
>
> This worker reads a queue, and processes it (sends queued emails).
> Sends 10, sleeps for a minute, sends 10 until done - very
> straightforward.
>
>
>
> My question is, what would be the best way to run this? I have
> assumed a cron like scheduled worker with a named key, but I don’t
> know. My worker looks like this:
>
>
>
> class EmailProcessorWorker < BackgrounDRb::Worker::RailsBase
>
> def do_work(args)
>
> queue = EmailQueue.new
>
> queue.process_queue
>
> end
>
> end
>
> EmailProcessorWorker.register
>
>
>
> I do all the work in a Rails Model, since I can unit test it
> outside of backgroundrb.
>
>
>
> Does anyone have a backgroundrb_schedules.yml file I could use as
> an example, and should this run something like every 15 minutes,
> etc., or should it start once, and loop endlessly inside do_work?
> Any thoughts or experience?
>
>
>
> Thanks for your input –
>
>
>
> Jim Scott
>
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.26/746 - Release Date:
> 4/4/2007 1:09 PM
>
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
-- Ezra Zygmuntowicz
-- Lead Rails Evangelist
-- ez at engineyard.com
-- Engine Yard, Serious Rails Hosting
-- (866) 518-YARD (9273)
More information about the Backgroundrb-devel
mailing list