From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Fri, 23 Oct 2009 18:47:39 +0000 (+0000)
Subject: make batch hold update streaming and perform each update within its own transaction
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=66b885c64b467c441287d238f4ff073e352792f5;p=evergreen%2Fmasslnc.git

make batch hold update streaming and perform each update within its own transaction

git-svn-id: svn://svn.open-ils.org/ILS/trunk@14584 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 b0cab5b998..2152b5c541 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Holds.pm
@@ -607,6 +607,7 @@ __PACKAGE__->register_method(
 __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 update_hold {
 
 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 {