From cfab134150254dda73842ab2a31dae96a4567e7c Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Wed, 1 Nov 2017 18:22:21 -0400 Subject: [PATCH] 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 --- .../src/perlmods/lib/OpenILS/Application/Search/Biblio.pm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) 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) || {}; -- 2.11.0