http://qs321.pair.com?node_id=773000


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...