https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41959

--- Comment #4 from Andreas Jonsson <[email protected]> ---
That is a great find!  But the fix is not correct, I think.

The mistake I made is to forget the edge case where all candidate holds under
consideration fails to be allocated, leaving $num_tasks == 0.  This will
incorrectly abort the RETRY-loop when there are remaining candidate holds in
the queue.

The purpose of the condition at the start of the RETRY-loop is to abort with
empty result if there is nothing more to consider, so the fix should be as
follows:


diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm
index e0602e595eb..6f82ca46d91 100644
--- a/C4/HoldsQueue.pm
+++ b/C4/HoldsQueue.pm
@@ -479,7 +479,7 @@ sub _allocateWithTransportCostMatrix {

 RETRY:
     while (1) {
-        return [] if $num_agents == 0 || $num_tasks == 0;
+        return [] if $num_agents == 0 || $num_tasks + scalar(@remaining) == 0;

         if ( $num_tasks < $num_agents && @remaining ) {

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to