Hi! I came little bit deeper in scheduling related codes and found some simple ideas that may improve it.
I think there are two ways to optimize scripts related to scheduling:
1. Do not use wrapper, but just user native AOL Server features. As I see from the code the only use of wrappers is to keep consitancy of monitoring information.
For monitoring needs ns_info scheduled should be enough .
Hence, wrappers is good from porting point of view.
2. In current version ad_schedule_proc save proc_info to the shared variables and pass the same info to the ad_run_schedule_proc. This way do not alllows to have proc_id returned by ns_schedule_proc in both proc_infos, passed to the ad_run_schedule_proc, and in shared vars. proc_id may be stored only in shared vars, couse this value is unknown at the moment of ns_schedule_proc execution.
I propose to pass only index of the proc_info in shared var to the ad_run_schedule_proc instead of all proc_info.
This way will also simplify ad_run_schedule_proc code.