From a08eaafa2e48ff1c09dab0d254979b569e0c34bb Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 28 May 2025 14:40:42 +0200 Subject: [PATCH] modulecmd: increase cache timeout to 4h --- Pmodules/modulecmd.bash.in | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 8d2d7e9..d777986 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1328,9 +1328,17 @@ get_available_modules() { get_module_config cfg "${dir}" "${rel_modulefile}" is_available cfg "${ReleaseStages}" || continue fi - modules[${mod}]=1 + modules[${rel_modulefile}]=1 - result+=( "${mod}" "${relstage}" "${dir}" "${rel_modulefile}" "${ol_name}" "${group}" ) + result+=( + "${long_module_name}" + "${relstage}" + "${dir}" + "${rel_modulefile}" + "${ol_name}" + "${group}" ) + + # return after first match, e.g. for loading a module [[ "${mode}" != 'search' ]] && return 0 done < <(${find} -L "${dir}" \ -not -name ".*" \ @@ -3035,7 +3043,8 @@ subcommand_search() { if [[ -r "${SpiderCache}" ]]; then local -i mtime=0 mtime=$( ${stat} --format %Y "${SpiderCache}" ) - (( CurTime - mtime <= 3600 )) && update_cache='no' + # cache expiration time is 4h + (( CurTime - mtime <= 14400 )) && update_cache='no' fi if [[ "${update_cache}" == 'yes' ]]; then std::info "(Re-)building the Pmodules cache. Please be patient ..." @@ -3043,6 +3052,7 @@ subcommand_search() { ${yq} -p j -o y '.*' | ${yq} '(.*.parentAA|select(.)) as $i ireduce({}; setpath($i | path; $i))')" echo "${spider_output}" > "${SpiderCache}" + std::info "Done ..." else spider_output=$(< "${SpiderCache}") fi