From: erickson Date: Wed, 27 Oct 2010 19:18:52 +0000 (+0000) Subject: since they typically repeat, cache the org and requestor objects in the permit loop... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=29e1f12b4dc87734f85464257e19f035b1b7329f;p=evergreen%2Ftadl.git since they typically repeat, cache the org and requestor objects in the permit loop of the find-best-hold calculation git-svn-id: svn://svn.open-ils.org/ILS/trunk@18505 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm index 020999a332..c66dcebdd2 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm @@ -2477,13 +2477,18 @@ sub find_nearest_permitted_hold { # for each potential hold, we have to run the permit script # to make sure the hold is actually permitted. + my %reqr_cache; + my %org_cache; for my $holdid (@$best_holds) { next unless $holdid; $logger->info("circulator: checking if hold $holdid is permitted for copy $bc"); my $hold = $editor->retrieve_action_hold_request($holdid) or next; - my $reqr = $editor->retrieve_actor_user($hold->requestor) or next; - my $rlib = $editor->retrieve_actor_org_unit($hold->request_lib) or next; + my $reqr = $reqr_cache{$hold->requestor} || $editor->retrieve_actor_user($hold->requestor); + my $rlib = $org_cache{$hold->request_lib} || $editor->retrieve_actor_org_unit($hold->request_lib); + + $reqr_cache{$hold->requestor} = $reqr; + $org_cache{$hold->request_lib} = $rlib; # see if this hold is permitted my $permitted = OpenILS::Utils::PermitHold::permit_copy_hold(