Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Scheduled event system [a little OT]

by bart (Canon)
on Jun 19, 2009 at 11:56 UTC ( #773000=note: print w/replies, xml ) Need Help??

in reply to Scheduled event system [a little OT]

What are the normal design patterns for a thing like this -- populate a database with multiple dates when a recurring event is added?

Well, the way I would do it, is to calculate when the next event will occur, and then schedule that. When that event is triggered, you can calculate the next occurrence. So there is never a need to store more than one date.

As for the exceptions list... You can use cron as the base, but instead of a command line, you store a symbolic name... or an ID. Specify the associated command line separately. You can have more entries for one name, and give each a precedence, pretty much just like the filter rules for an email/usenet client. Specify what you want to happen: run, or suppress. The first rule that triggers specifies what will happen at that specified time. And when the verdict is to suppress, you'll have to calculate the next occurrence after that time...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://773000]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (4)
As of 2021-04-17 16:26 GMT
Find Nodes?
    Voting Booth?

    No recent polls found