[open-ils-commits] r18312 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Oct 13 12:17:17 EDT 2010
Author: miker
Date: 2010-10-13 12:17:14 -0400 (Wed, 13 Oct 2010)
New Revision: 18312
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm
Log:
Use just one transaction, and inside an rstore editor no less, for fleshing env paths
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm 2010-10-13 16:13:23 UTC (rev 18311)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Event.pm 2010-10-13 16:17:14 UTC (rev 18312)
@@ -481,11 +481,16 @@
my $collector = shift;
my $label = shift;
my $path = shift;
+ my $ed = shift;
+ my $outer = 0;
+ if (!$ed) {
+ $ed = new_rstore_editor(xact=>1);
+ $outer = 1;
+ }
my $step = shift(@$path);
-
my $fhint = Fieldmapper->publish_fieldmapper->{$context->class_name}{links}{$step}{class};
my $fclass = $self->_fm_class_by_hint( $fhint );
@@ -509,10 +514,6 @@
$meth =~ s/Fieldmapper:://;
$meth =~ s/::/_/g;
- my $ed = grep( /open-ils.cstore/, @{$fclass->Controller} ) ?
- $self->editor :
- new_rstore_editor(($self->standalone ? () : (xact=>1)));
-
my $obj = $context->$step();
$logger->debug(
@@ -529,18 +530,10 @@
my $def_id = $self->event->event_def->id;
my $str_path = join('.', @$path);
- if ($self->standalone) {
- $ed->xact_begin || return undef;
- }
-
$obj = $_object_by_path_cache{$def_id}{$str_path}{$step}{$ffield}{$lval} ||
$ed->$meth( ($multi) ? { $ffield => $lval } : $lval);
$_object_by_path_cache{$def_id}{$str_path}{$step}{$ffield}{$lval} ||= $obj;
-
- if ($self->standalone) {
- $ed->xact_rollback || return undef;
- }
}
}
@@ -555,7 +548,7 @@
for (@$obj_list) {
my @path_clone = @$path;
- $self->_object_by_path( $_, $collector, $label, \@path_clone );
+ $self->_object_by_path( $_, $collector, $label, \@path_clone, $ed );
}
$obj = $$obj_list[0] if (!$multi || $rtype eq 'might_have');
@@ -598,6 +591,7 @@
}
}
+ $ed->rollback if ($outer);
return $obj;
}
More information about the open-ils-commits
mailing list