Forum OpenACS Q&A: Scheduled Procs and Package IDs

Collapse
Posted by Steve Manning on
I have a scheduled proc which needs to read a parameter for the package. Parameter::get needs the package_id passing in else it tries to use ad_conn package_id. Obviously it can't use ad_conn package_id as there is no connection so how does one find the package id?

I thought of using apm_package_id_from_key but this will error if the package is mounted more than once.


    - Steve

Collapse
Posted by Tilmann Singer on
If the scheduled proc should do something for each mounted package then it might need to be scheduled or called for each instance separately. Look at how the irc-logger package in contrib handles this. If it should only be called once then maybe you should consider storing the parameter elsewhere than the package parameter - what if two instances have a contradicting setting, which should it use then?
Collapse
Posted by Steve Manning on
Thanks Tilmann

I'll take a look at the irc-logger code.

The point was that each package instance would have a different parameter value. I'm not sure if there is a better way to store parameters for a package instance. I only have the requirement for one instance of the package at the moment which is why the apm_package_id_from_key hack works.

The most obvious fix I've come up with to tracking the package_id is to have each instance keep track of its own package id and give it up on request via a proc. I just need a way to get the package id as the instance starts up.

  - Steve