From 54c972c3aecb4bb2bdc57af2d0a841b56b4d566c Mon Sep 17 00:00:00 2001 From: miker Date: Sun, 18 Jul 2010 00:21:09 +0000 Subject: [PATCH] remove ingest service call from authority import thanks to in-db ingest of auth by dbs; send final message with total and count processed; send record counts at most every 3%; rearrange queue cleanup code to aviod needless rollback and cover all queues, not just the first one we test git-svn-id: svn://svn.open-ils.org/ILS/trunk@16972 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Vandelay.pm | 31 +++++----------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm index cea3c08bd..7c146c4e4 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm @@ -608,8 +608,8 @@ sub import_record_list_impl { my $type = $self->{record_type}; my $total = @$rec_ids; my $count = 0; + my $step = '1' . '0' x ((length($total) * 3) - 2); my %queues; - my @ingest_queue; my $auto_overlay_exact = $$args{auto_overlay_exact}; my $auto_overlay_1match = $$args{auto_overlay_1match}; my $merge_profile = $$args{merge_profile}; @@ -635,8 +635,6 @@ sub import_record_list_impl { $rec_class = 'vqar'; } - my $ingest_ses = OpenSRF::AppSession->connect('open-ils.ingest'); - for my $rec_id (@$rec_ids) { my $overlay_target = $overlay_map->{$rec_id}; @@ -744,10 +742,6 @@ sub import_record_list_impl { } else { $record = OpenILS::Application::Cat::AuthCommon->import_authority_record($e, $rec->marc); #$source); - push @ingest_queue, { - req => $ingest_ses->request('open-ils.ingest.full.authority.record', $record->id), - rec_id => $record->id - }; } if($U->event_code($record)) { @@ -766,23 +760,20 @@ sub import_record_list_impl { } if($imported) { - $e->commit; - $conn->respond({total => $total, progress => ++$count, imported => $rec_id}); - } else { - $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}) if (++$count % 10) == 0; + $conn->respond({total => $total, progress => $count, imported => $rec_id}) if (++$count % $step) == 0; } # see if we need to mark any queues as complete - my $e = new_editor(xact => 1); for my $q_id (keys %queues) { + my $e = new_editor(xact => 1); my $remaining = $e->$search_func( [{queue => $q_id, import_time => undef}, {limit =>1}], {idlist => 1}); @@ -793,21 +784,13 @@ sub import_record_list_impl { $queue->complete('t'); $e->$update_queue_func($queue) or return $e->die_event; $e->commit; - last + next; } - } + $e->rollback; } - $e->rollback; - $count = 0; - for my $ingest (@ingest_queue) { - try { $ingest->{req}->gather(1); } otherwise {}; - $conn->respond({total => $total, progress => $count, imported => $ingest->{rec_id}}) if (++$count % 10) == 0; - } - - $ingest_ses->disconnect(); - return undef; + return {total => $total, progress => $count}; } -- 2.11.0