From 50b517a4d2e707fec71ca4c95690316ef84c5f3f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 11 Aug 2021 07:46:25 -0400 Subject: [PATCH] Bug 28833: (follow-up) Only spawn multiple processes if there are more records than loops specified --- C4/HoldsQueue.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm index ebbeeb53f6..c804d960b7 100644 --- a/C4/HoldsQueue.pm +++ b/C4/HoldsQueue.pm @@ -201,6 +201,7 @@ sub CreateQueue { # Split the list of bibs into groups to run in parallel if ( $loops > 1 ) { my $bibs_per_chunk = ceil( scalar @$bibs_with_pending_requests / $loops ); + $bibs_per_chunk = @$bibs_with_pending_requests if @$bibs_with_pending_requests <= $bibs_per_chunk; my @chunks; push( @chunks, [ splice @$bibs_with_pending_requests, 0, $bibs_per_chunk ] ) while @$bibs_with_pending_requests; -- 2.30.1 (Apple Git-130)