[open-ils-commits] r18506 - branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 27 15:19:31 EDT 2010
Author: erickson
Date: 2010-10-27 15:19:26 -0400 (Wed, 27 Oct 2010)
New Revision: 18506
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
since they typically repeat, cache the org and requestor objects in the permit loop of the find-best-hold calculation
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2010-10-27 19:18:52 UTC (rev 18505)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm 2010-10-27 19:19:26 UTC (rev 18506)
@@ -2477,14 +2477,19 @@
# 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(
{ patron_id => $hold->usr,
More information about the open-ils-commits
mailing list