[open-ils-commits] r14584 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Oct 23 14:47:44 EDT 2009


Author: erickson
Date: 2009-10-23 14:47:39 -0400 (Fri, 23 Oct 2009)
New Revision: 14584

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
Log:
make batch hold update streaming and perform each update within its own transaction

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-10-23 18:43:57 UTC (rev 14583)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm	2009-10-23 18:47:39 UTC (rev 14584)
@@ -607,6 +607,7 @@
 __PACKAGE__->register_method(
 	method	=> "batch_update_hold",
 	api_name	=> "open-ils.circ.hold.update.batch",
+    stream => 1,
 	notes		=> <<"	NOTE");
 	Updates the specified hold.  The login session
 	is the requestor and if the requestor is different from the usr field
@@ -625,19 +626,22 @@
 
 sub batch_update_hold {
 	my($self, $client, $auth, $hold_list, $values_list) = @_;
-    my $e = new_editor(authtoken=>$auth, xact => 1);
+    my $e = new_editor(authtoken=>$auth);
     return $e->die_event unless $e->checkauth;
 
     my $count = ($hold_list) ? scalar(@$hold_list) : scalar(@$values_list);
     $hold_list ||= [];
     $values_list ||= [];
+
     for my $idx (0..$count-1) {
+        $e->xact_begin;
         my $resp = update_hold_impl($self, $e, $hold_list->[$idx], $values_list->[$idx]);
-        return $resp if $U->event_code($resp);
+        $e->xact_commit unless $U->event_code($resp);
+        $client->respond($resp);
     }
 
-    $e->commit;
-    return 1;
+    $e->disconnect;
+    return undef;
 }
 
 sub update_hold_impl {



More information about the open-ils-commits mailing list