Forum OpenACS Q&A: Scheduled Procedures

Collapse
Posted by Andrew Zeon on
Hi,

I've heard that there exists scheduled procedures something in the 
form of:

ad_schedule_proc -thread t -once t 2 [list my_proc $argument1 
$argument2 ...]

Where can I get information and examples on this?

Thanks.

Collapse
Posted by Andrew Zeon on
I've found where I can view the API for this ad_schedule_proc
procedure, but I need some examples... where can I see some usage of
this procedure?

My whole purpose is for the calendar to send SMS messages at a
specified time. Right now, I've got the SMS message being sent
instantaneously (as soon as you add an event to the calendar).
However, I want the SMS to be sent at a specified time (e.g. at 4th
October 2:50pm).

Thanks.

Collapse
Posted by Bart Teeuwisse on
Andrew,

take a look at the ecommerce-scheduled-procs.tcl file in the ecommerce package for some examples of scheduling procs with ad_schedule_proc.

/Bart

Collapse
Posted by carl garland on
I would be careful about just scheduling a proc for each message that you want to send. What happens if the server crashes or is reset. An approach you may want to take is having a database table of when/what procs are needing to be executed. Then have one scheduled proc that pops the next event off the db stack of jobs and schedules that job in a detached thread. Then when actually processing job remove that job from the stack. You would need to make sure when adding any new jobs that it may take priority over the next scheduled job.
Collapse
Posted by Andrew Zeon on
Carl,

That was another way I had in mind. Are there any examples that
could start me off?

Thanks.