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=7b4849c92c6bab2a7dc3615390efc323c9a50712;p=Evergreen.git Add a $cache_timeout-based backstop for infinite loops Signed-off-by: Mike Rylander Signed-off-by: Jason Etheridge Signed-off-by: Lebbeous Fogle-Weekley --- 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 20cdd09e26..17fb6f66bd 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -1257,7 +1257,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}); }