[open-ils-commits] r19783 - branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Mar 16 14:20:08 EDT 2011


Author: erickson
Date: 2011-03-16 14:20:03 -0400 (Wed, 16 Mar 2011)
New Revision: 19783

Modified:
   branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
Log:
make payment receipt print/email run inside a transaction.  instead of using authoritative, force the xact for reasons mentioned in the comments

Modified: branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm
===================================================================
--- branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm	2011-03-16 18:19:20 UTC (rev 19782)
+++ branches/rel_2_1/Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Money.pm	2011-03-16 18:20:03 UTC (rev 19783)
@@ -520,9 +520,13 @@
 
     my $for_print = ($self->api_name =~ /print/);
     my $for_email = ($self->api_name =~ /email/);
-    my $e = new_editor(authtoken => $auth);
-    return $e->event unless $e->checkauth;
 
+    # manually use xact (i.e. authoritative) so we can kill the cstore
+    # connection before sending the action/trigger request.  This prevents our cstore
+    # backend from sitting idle while A/T (which uses its own transactions) runs.
+    my $e = new_editor(xact => 1, authtoken => $auth);
+    return $e->die_event unless $e->checkauth;
+
     my $payments = [];
     for my $id (@$mp_ids) {
 
@@ -534,15 +538,17 @@
                     mbt => ['usr']
                 }
             }
-        ]) or return $e->event;
+        ]) or return $e->die_event;
 
-        return $e->event unless 
+        return $e->die_event unless 
             $e->requestor->id == $payment->xact->usr->id or
             $e->allowed('VIEW_TRANSACTION', $payment->xact->usr->home_ou); 
 
         push @$payments, $payment;
     }
 
+    $e->rollback;
+
     if ($for_print) {
 
         return $U->fire_object_event(undef, 'money.format.payment_receipt.print', $payments, $$payments[0]->xact->usr->home_ou);



More information about the open-ils-commits mailing list