[Backgroundrb-devel] Doing max of N tasks per given time

Dale Cook petesalty at gmail.com
Thu Jan 29 21:13:38 EST 2009


What I would do is push all the records that need to be mailed to a table
(or flag them in a table they already reside in). Then you can have BDRB set
up to run once an hour - it picks up the most recent (or the oldest, or some
other combination, your choice) and mails them, 250 each hour until there
are none left. You can add in records whenever you want, confident that they
will go out eventually.
Trying to do it another way, i.e. sending out 250, then setting up a
schedule to send out the rest, could be done but it's a lot harder and
probably doesn't get you much more, especially for the 251st and onward
email recipients, plus you then have to deal with the issue of that happens
if you need to send another batch of 250+ within an hour of the first being
sent - what to do then?

You can read more about BDRB cron scheduling at
http://backgroundrb.rubyforge.org/scheduling/ (this isn't one of my
strengths unfortunately).

Hope this helped some.

On Tue, Jan 27, 2009 at 1:14 AM, Ramon Tayag <ramon.tayag at gmail.com> wrote:

> Hey everyone,
> I need some backgroundrb help.  I have a Rails app that connects to an
> SMTP server that can only send up to 250 emails per hour.  If I try to
> send the 251st email, it will just ignore it.
> I almost bashed my head trying to setup sendmail so I can send my own
> emails, but not all emails were being sent.
> Looking at http://backgroundrb.rubyforge.org/scheduling/ , I can see
> that there are many things I can do with backgroundrb, but I can't
> seem to figure out how to do what's written on the subject.
> I basically want to send up to 250 emails immediately, and queue the
> 251st email til after the next hour since the max limit of 250 will be
> reset.  Is this possible with backgroundrb?
> Thanks,
> Ramon Tayag
> _______________________________________________
> Backgroundrb-devel mailing list
> Backgroundrb-devel at rubyforge.org
> http://rubyforge.org/mailman/listinfo/backgroundrb-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/backgroundrb-devel/attachments/20090129/9951a315/attachment.html>

More information about the Backgroundrb-devel mailing list