Index: openacs-4/packages/xowf/tcl/xowf-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/xowf-init.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/xowf/tcl/xowf-init.tcl 18 Jul 2018 22:33:25 -0000 1.3 +++ openacs-4/packages/xowf/tcl/xowf-init.tcl 23 Jul 2019 10:12:25 -0000 1.3.2.1 @@ -2,11 +2,29 @@ # register the dav interface for the todos ::xowf::dav-todo register -# run the checker for the scheduled at-jobs -ad_schedule_proc -thread t 60 ::xowf::atjob check +# +# Run the checker for the scheduled at-jobs. +# +# As we are trying to run as close as possible to the minute change, +# the "ns_after" is used to delay the registration past the end of the +# minute. To avoid potential misses of jobs between the execution time +# of the init script and the end of the minute, we delay both, the +# cleanup of the old entries and we start the repeating proc 60 +# seconds later. +# +set secs_to_the_minute [expr {60 - ([clock seconds] % 60)}] +ns_after $secs_to_the_minute { -# make sure, we have not missed some at-jobs, while we were down -ad_schedule_proc -thread t -once t 1 ::xowf::atjob check -with_older true + # Make sure, we have not missed some at-jobs, while we were down + ad_schedule_proc -thread t -once t 1 ::xowf::atjob check -with_older true + + ns_after 60 { + ad_schedule_proc -thread t 60 ::xowf::atjob check + } + +} + + # Local variables: # mode: tcl # tcl-indent-level: 2