From: Mike Rylander Date: Wed, 1 Nov 2017 22:22:21 +0000 (-0400) Subject: LP#1704396: Don't use alarm() for facet timeout X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cfab134150254dda73842ab2a31dae96a4567e7c;p=working%2FEvergreen.git LP#1704396: Don't use alarm() for facet timeout Use a loop to count up, 50ms at a time, to 10 seconds max. Signed-off-by: Mike Rylander --- 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 4a0336d125..c26e9e12e0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Biblio.pm @@ -1362,13 +1362,12 @@ sub retrieve_cached_facets { return undef unless ($key and $key =~ /_facets$/); - eval { - local $SIG{ALRM} = sub {die}; - alarm(4); # we'll sleep for as much as 4s - do { - die if $cache->get_cache($key . '_COMPLETE'); - } while (sleep(0.05)); - }; + my $count = 0; + while ( + $count < 200 && # 200 * 50ms == 10s + !$cache->get_cache($key . '_COMPLETE') && + sleep(0.05) + ) { $count++ }; my $blob = $cache->get_cache($key) || {};