From: Jason Stephenson Date: Wed, 21 Jan 2015 20:02:55 +0000 (-0500) Subject: LP#1413336: Fixing up CStoreEditor use in Action Triggers. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=86753a1b51e16333ace4de33e45f2abd25dcc01e;p=working%2FEvergreen.git LP#1413336: Fixing up CStoreEditor use in Action Triggers. CStoreEditor transactions are used in O::A::Trigger and in O::A::Trigger::Reactor to get authoritave results in search and retrieve calls. Some of these needed to have a rollback added. Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm index ed83cbae1b..604220b053 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger.pm @@ -357,6 +357,8 @@ sub events_by_target { $client->respond($event); } + $e->rollback; + return undef; } __PACKAGE__->register_method( @@ -657,9 +659,13 @@ sub pending_events { $query->[0]->{'+atevdef'} = {granularity => undef}; } - return new_editor(xact=>1)->search_action_trigger_event( + my $e = new_editor(xact=>1); + my $events = $e->search_action_trigger_event( $query, { idlist=> 1, timeout => 7200, substream => 1 } ); + $e->rollback; + + return $events; } __PACKAGE__->register_method( api_name => 'open-ils.trigger.event.find_pending', diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm index 7c9127aa0f..29e9c21b20 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Trigger/Reactor.pm @@ -95,7 +95,10 @@ $_TT_helpers = { # returns the calculated copy price get_copy_price => sub { my $copy_id = shift; - return $U->get_copy_price(new_editor(xact=>1), $copy_id); + my $e = new_editor(xact=>1); + my $price = $U->get_copy_price($e, $copy_id); + $e->rollback; + return $price; }, get_org_unit => sub { @@ -107,7 +110,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 +121,7 @@ $_TT_helpers = { } } ]); + $e->rollback; if($copy->call_number->id == -1) { return { title => $copy->dummy_title, @@ -159,9 +164,11 @@ $_TT_helpers = { } } - my $location = new_editor(xact=>1)->retrieve_asset_copy_location([ + my $e = new_editor(xact=>1); + my $location = $e->retrieve_asset_copy_location([ $winning_location, {} ]); + $e->rollback; return $location; },