Build yourself a carousel and with buckets some time (15 min?) apart.
Install each user's task in it's bucket and rotate the carousel with
the clock.  As a bucket appears, service any tasks it contains and
move them to the appropriate future bucket.

This is fairly easy to do with a doubly linked list - I'm not to sure
yet how it maps into the MVC world view.

On Oct 20, 4:33 pm, Jeff Pritchard <[EMAIL PROTECTED]>
wrote:
> OK, time to come clean.  Right now my app is doing something really
> cheesy.  The first step is alway admitting that you have a problem,
> right?
>
> So here's the deal.  One of the features of my app is that, based on
> some user settings, it is supposed to send out "reminder" emails at
> certain times of the day.  Each user has their own time settings for
> these reminders.
>
> Right now I have a background task that, once every 15 mins, looks at
> every gosh darn user and decides whether or not to send them a reminder.
> Once every 15 mins I hit every single user row in the database.
> brrrrrrr.  Yeah, I know, gives me the willies too.
>
> So is there some sort of a "best practice" established for how to do
> some caching/intelligent-scheduling to overcome this horrendous mis-use
> of the database?  Is there some sort of a plugin that would allow me to
> sort the database by that time-of-day column and intelligently find just
> those within a certain range of times?
>
> I'm very nearly an SQL virgin, so if this is painfully simple and I'm
> just a moron, be gentle.
>
> thanks,
> jp
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to