Use a loop to count up, 50ms at a time, to 10 seconds max.
Signed-off-by: Mike Rylander <mrylander@gmail.com>
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) || {};