From: Mike Rylander Date: Fri, 26 Apr 2013 15:28:38 +0000 (-0400) Subject: Add a $cache_timeout-based backstop for infinite loops X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6a7c526aaed9af40f7ac7855e6ca3094da2bdc59;p=evergreen%2Fmasslnc.git Add a $cache_timeout-based backstop for infinite loops Signed-off-by: Mike Rylander Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm index 3975edae13..5ea3602204 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -1302,7 +1302,8 @@ sub staged_search { # and complexity, this is close to the best we can do. if ($cache_data->{running}) { # someone is already doing the search... - while ( sleep(1) ) { # sleep for a second ... maybe they'll finish + my $stop_looping = time() + $cache_timeout; + while ( sleep(1) and time() < $stop_looping ) { # sleep for a second ... maybe they'll finish $cache_data = $cache->get_cache($key) || {}; last if (!$cache_data->{running}); }