[Backgroundrb-devel] Multiple Worker Classes

hemant gethemant at gmail.com
Tue Mar 17 13:09:41 EDT 2009


On Tue, Mar 17, 2009 at 2:14 AM, Adam Williams <adam at thewilliams.ws> wrote:
> Hello,
>
> I had multiple worker classes, each set to load once. Some were adding
> periodic executions, some had scheduled work. I've discovered that this
> means there will be a worker process for each class. In an effort to get
> down to just one worker process (memory consumption was unaffordable), I
> have moved ALL work methods into one class. None of the methods assign any
> instance variables. Three of them are run periodically, three of them are
> scheduled.
>
>  def create(args = nil)
>    add_periodic_timer(1.minute)  { deliver_reminders }
>    add_periodic_timer(2.minutes) { process_emails }
>    add_periodic_timer(3.minutes) { deliver_invitations }
>
>  backgroundrb.yml
>    :schedules:
>      :single_worker:
>        :deliver_hub_member_joins:
>          :trigger_args: '59 59 23 * * * *'
>        :deliver_expiration_reminders:
>          :trigger_args: '59 59 23 * * * *'
>        :deliver_trial_ending_reminders:
>          :trigger_args: '59 59 23 * * * *'
>
> Is there anything I should be aware of with this kind of configuration?
> Anything that I should expect to fail?
>

Since you are scheduling all your tasks within same worker, its
possible that some scheduled job that takes more time may not let
other scheduled jobs to run immediately. If this happens, your jobs
will run delayed accordingly.
Hence its advisable to tune time window between various scheduled jobs.



> On another note, I have the schedules as "59 59 23 * * * *" because last
> weekend backgroundrb began to run "0 0 0 * * * *" as 'every second' instead
> of as 'midnight'. I looked at the tests for the cron scheduler code, and
> there isn't one for "0 0 0 * * * *"; also, most of the other cron tests
> failed too. Worked great for months, then we went from -5GMT to -4GMT.
> Coincidence?
>
> Thanks for a great tool!
>
>  adam
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
>



-- 
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