Index: openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl 11 Aug 2005 11:50:27 -0000 1.2 +++ openacs-4/packages/dotlrn-ecommerce/tcl/dotlrn-ecommerce-init.tcl 18 Aug 2005 14:30:28 -0000 1.3 @@ -12,5 +12,5 @@ ad_schedule_proc -thread t 300 dotlrn_ecommerce::section::check_elapsed_registrations ad_schedule_proc -thread t 600 dotlrn_ecommerce::section::check_and_approve_sections_for_slots - -ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 23 50] dotlrn_ecommerce::notify_admins_of_waitlist \ No newline at end of file +ad_schedule_proc -thread t -schedule_proc ns_schedule_daily [list 23 50] dotlrn_ecommerce::notify_admins_of_waitlist +ad_schedule_proc -thread t -once t 660 dotlrn_ecommerce::section::check_expired_orders_once \ No newline at end of file Index: openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 11 Aug 2005 01:04:18 -0000 1.21 +++ openacs-4/packages/dotlrn-ecommerce/tcl/section-procs.tcl 18 Aug 2005 14:30:28 -0000 1.22 @@ -623,3 +623,50 @@ return [list] } + +ad_proc -public dotlrn_ecommerce::section::check_expired_orders { +} { + Check recently expired orders in shopping cart and flush the cache + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-08-18 + + @return + + @error +} { + # Loop thru recently expired orders + db_foreach expired_orders { + select order_id + from ec_orders + where order_state = 'expired' + and expired_date > (current_timestamp - '10 minutes'::interval) + } { + # Loop thru recently expired items, and flush the cached section + db_foreach expired_items { + select s.section_id + from ec_items i, dotlrn_ecommerce_section s + where i.product_id = s.product_id + and order_state = 'expired' + and expired_date > (current_timestamp - '10 minutes'::interval) + } { + util_memoize_flush [list dotlrn_ecommerce::section::attendees $section_id] + } + } +} + +ad_proc -public dotlrn_ecommerce::section::check_expired_orders_once { +} { + Reschedule checking of expired orders + + @author Roel Canicula (roelmc@pldtdsl.net) + @creation-date 2005-08-18 + + @return + + @error +} { + dotlrn_ecommerce::section::check_expired_orders + + ad_schedule_proc -thread t 600 dotlrn_ecommerce::section::check_expired_orders +}