Take a look at the Rufus Scheduler http://rufus.rubyforge.org/rufus-scheduler/
I hope this help you, regards.
Franco Catena.
On Aug 27, 4:59 pm, Rukku Bala
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> Hi,
> I am trying to achieve the following.. wondering if there is any way to
> achieve this..
>
> Some background:
>
> 1. i have an application where the user can request an specific email to
> be sent at a scheduled time. For e.g. lets say user A wants is
> scheudling the email to be sent for 12:00pm. This is stored in a table
> called "send_notification" where the details is stored.
> 2. Another user B can login and schedule an notification say at 11:45am.
>
> Now, to achieve this..
> Option 1:
> If can have a background task that scans through this table and sends
> the notification. But if i write it as a task that wakes up every minute
> and send the notification, then it has to scan the whole table every
> time. Is it OK ?. In a scaled table it could be an issue.
> Opton 2:
> Maintain a "earliest time" variable in the application. Every
time, a
> new notification is created, check if this time is earlier than the
> "earliest time". If so, then cancel the crontab and reschedule
based on
> the "earliest time". If not, the crontab will expire and
notification
> will be sent and scan the whole table and update the "earliest
time".
> This again has the flaw of scanning the entire table.
>
> Option 3:
> an efficient option is to maintain a heap timer tree based on
"shcedule
> time". Then the top node timer expires, the notification will be sent.
> This would require no scanning of table but maintaining the heap timer.
> Is a there a plugin for this ?.
>
> How does typcially achieve such a thing.
>
> Thanks.
> --
> Posted viahttp://www.ruby-forum.com/.