[Backgroundrb-devel] Multiple Worker Classes
hemant
gethemant at gmail.com
Tue Mar 17 13:10:30 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?
>
> 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?
>
You might be hitting on a bug. It would be really helpful if you can
minimize a testcase and attach here.
More information about the Backgroundrb-devel
mailing list