From 921930767ebe0205d95302f36e9a311ab39b0635 Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 27 Sep 2010 18:26:29 +0000 Subject: [PATCH] use transaction when gathering records from a newly created queue; adjust rollback usage in import loop git-svn-id: svn://svn.open-ils.org/ILS/trunk@18034 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm index 3572e81365..3500d4acec 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm @@ -395,8 +395,8 @@ __PACKAGE__->register_method( sub retrieve_queued_records { my($self, $conn, $auth, $queue_id, $options) = @_; - my $e = new_editor(authtoken => $auth); - return $e->event unless $e->checkauth; + my $e = new_editor(authtoken => $auth, xact => 1); + return $e->die_event unless $e->checkauth; $options ||= {}; my $limit = $$options{limit} || 20; my $offset = $$options{offset} || 0; @@ -409,7 +409,10 @@ sub retrieve_queued_records { $queue = $e->retrieve_vandelay_authority_queue($queue_id) or return $e->die_event; } my $evt = check_queue_perms($e, $type, $queue); - return $evt if $evt; + if ($evt) {; + $e->rollback; + return $evt; + } my $class = ($type eq 'bib') ? 'vqbr' : 'vqar'; my $search = ($type eq 'bib') ? @@ -443,6 +446,7 @@ sub retrieve_queued_records { $rec->clear_marc if $$options{clear_marc}; $conn->respond($rec); } + $e->rollback; return undef; } @@ -650,7 +654,7 @@ sub import_record_list_impl { ]); unless($rec) { - $conn->respond({total => $total, progress => ++$count, imported => $rec_id, err_event => $e->die_event}); + $conn->respond({total => $total, progress => ++$count, imported => $rec_id, err_event => $e->event}); $e->rollback; next; } @@ -761,9 +765,9 @@ sub import_record_list_impl { if($imported) { $e->commit; } else { - $e->rollback; + # die_event inside of biblio_record_xml_import or import_authority_record has taken care of $e->rollback; # Send an update whenever there's an error - $conn->respond({total => $total, progress => ++$count, imported => $rec_id, err_event => $e->die_event}); + $conn->respond({total => $total, progress => ++$count, imported => $rec_id, err_event => $e->event}); } $conn->respond({total => $total, progress => $count, imported => $rec_id}) if (!$report_all and ++$count % $step) == 0; -- 2.11.0