Using MySql and Java, I have to write a program for reminders. A reminder's date and time could be set and then an alert to the user is displayed on the date and time that was set.
How do I know that it is now time to alert the user? I do not want to check the reminders table every five minutes. Most of the search at google returned birthday reminders that work on a specific date. Checking for a date once in a day is alright but how to manage time-based reminders?
Reminder Program
-
- Lance Naik
- Posts: 44
- Joined: Thu Aug 31, 2006 8:52 pm
- Location: Lahore Pakistan
- Contact:
-
- Lance Naik
- Posts: 44
- Joined: Thu Aug 31, 2006 8:52 pm
- Location: Lahore Pakistan
- Contact:
The reminder can be set for any time in hours and minutes. With dozens of users using the reminder option in a web application, querying (probably) hundreds of reminders every minute does not seem to be a good idea.lambda wrote:why don't you want to check once every five minutes?
It sounds good. I'll look into it. Thanks.lambda wrote:i guess you could load the next hour's data once an hour, and then fire off threads to deal with the messaging every five minutes.
you should profile instead of speculating. with the appropriate index on reminder date/time, it probably won't take very long. for example, it takes me about 2 seconds to select over 42,000 records on a slow celeron-class 1ghz computer (with one ide drive).waqaskhawaja wrote:The reminder can be set for any time in hours and minutes. With dozens of users using the reminder option in a web application, querying (probably) hundreds of reminders every minute does not seem to be a good idea.