Index: openacs-4/packages/acs-tcl/tcl/apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/apm-procs.tcl,v diff -u -N -r1.114.2.28 -r1.114.2.29 --- openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 22 Feb 2021 17:01:44 -0000 1.114.2.28 +++ openacs-4/packages/acs-tcl/tcl/apm-procs.tcl 22 Feb 2021 17:41:53 -0000 1.114.2.29 @@ -1320,8 +1320,17 @@ return $result } +ad_proc -public apm_flush_package_id_cache {package_key} { + Flush the package id cache for this package at least in the + current thread. TODO: should be refactored together with the + 2level cache (per thread and util_memoize). +} { + unset -nocomplain ::apm::package_id_from_key($package_key) + util_memoize_flush [list apm_package_id_from_key_not_cached $package_key] +} + ad_proc -private apm_package_id_from_key_not_cached {package_key} { - unmemoized version of apm_package_id_from_key + DB accessing version of apm_package_id_from_key. } { return [db_string apm_package_id_from_key { select package_id from apm_packages where package_key = :package_key Index: openacs-4/packages/search/tcl/search-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/search/tcl/search-init.tcl,v diff -u -N -r1.13.2.2 -r1.13.2.3 --- openacs-4/packages/search/tcl/search-init.tcl 22 Feb 2021 17:01:44 -0000 1.13.2.2 +++ openacs-4/packages/search/tcl/search-init.tcl 22 Feb 2021 17:41:53 -0000 1.13.2.3 @@ -5,16 +5,17 @@ ad_proc -private search::init::schedule_indexer {} { - Schedule the indexer if the search package has been instantiated (indexing doesn't work - if it hasn't been, so why should we schedule it?). + Schedule the indexer if the search package has been instantiated + (indexing doesn't work if it hasn't been, so why should we + schedule it?). - We do not use the cached api apm_package_id_from_key to avoid - forcing the user to restart their server after mounting search. } { - set package_id [db_string get_package { - select package_id from apm_packages - where package_key = 'search' - } -default 0] + # + # Flush cache to avoid forcing the user to restart their server + # after mounting search. + # + apm_flush_package_id_cache search + set package_id [apm_package_id_from_key search] if { $package_id != 0 } { ad_schedule_proc \ -thread t [parameter::get \