Repair cstore transaction leak in A/T reactor helper
authorBill Erickson <berick@esilibrary.com>
Wed, 5 Dec 2012 18:52:01 +0000 (13:52 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 5 Dec 2012 18:52:01 +0000 (13:52 -0500)
This is not good:

my $copy = new_editor(xact=>1)->retrieve_asset_copy(...)

This opens a connection to a cstore drone and creates a
transaction without closing the transaction or connection, causing the
cstore drone to be idle and un-usable for the duration of the keepalive
timeout.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm

index d53a52d..0966bfd 100644 (file)
@@ -107,7 +107,8 @@ $_TT_helpers = {
     # given a copy, returns the title and author in a hash
     get_copy_bib_basics => sub {
         my $copy_id = shift;
-        my $copy = new_editor(xact=>1)->retrieve_asset_copy([
+        my $e = new_editor(xact => 1);
+        my $copy = $e->retrieve_asset_copy([
             $copy_id,
             {
                 flesh => 2,
@@ -117,6 +118,7 @@ $_TT_helpers = {
                 }
             }
         ]);
+        $e->rollback;
         if($copy->call_number->id == -1) {
             return {
                 title  => $copy->dummy_title,