[open-ils-commits] r11414 - in branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application: . Cat
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Dec 4 18:10:23 EST 2008
Author: erickson
Date: 2008-12-04 18:10:18 -0500 (Thu, 04 Dec 2008)
New Revision: 11414
Modified:
branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Log:
backporting vandelay fixes to support queued ingest requests. backporting missing namespace prefix in tcn code
Modified: branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm
===================================================================
--- branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm 2008-12-04 23:08:28 UTC (rev 11413)
+++ branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Cat/BibCommon.pm 2008-12-04 23:10:18 UTC (rev 11414)
@@ -36,7 +36,7 @@
sub biblio_record_replace_marc {
- my($class, $e, $recid, $newxml, $source, $fixtcn, $override) = @_;
+ my($class, $e, $recid, $newxml, $source, $fixtcn, $override, $noingest) = @_;
my $rec = $e->retrieve_biblio_record_entry($recid)
or return $e->die_event;
@@ -70,15 +70,17 @@
$rec->marc( $U->entityize( $marcdoc->documentElement->toString ) );
$e->update_biblio_record_entry($rec) or return $e->die_event;
- # we don't care about the result, just fire off the request
- my $ses = OpenSRF::AppSession->create('open-ils.ingest');
- $ses->request('open-ils.ingest.full.biblio.record', $recid);
+ unless ($noingest) {
+ # we don't care about the result, just fire off the request
+ my $ses = OpenSRF::AppSession->create('open-ils.ingest');
+ $ses->request('open-ils.ingest.full.biblio.record', $recid);
+ }
return $rec;
}
sub biblio_record_xml_import {
- my($class, $e, $xml, $source, $auto_tcn, $override) = @_;
+ my($class, $e, $xml, $source, $auto_tcn, $override, $noingest) = @_;
my( $evt, $tcn, $tcn_source, $marcdoc );
@@ -107,9 +109,11 @@
$record = $e->create_biblio_record_entry($record) or return $e->die_event;
$logger->info("marc create/import created new record ".$record->id);
- # we don't care about the result, just fire off the request
- my $ses = OpenSRF::AppSession->create('open-ils.ingest');
- $ses->request('open-ils.ingest.full.biblio.record', $record->id);
+ unless ($noingest) {
+ # we don't care about the result, just fire off the request
+ my $ses = OpenSRF::AppSession->create('open-ils.ingest');
+ $ses->request('open-ils.ingest.full.biblio.record', $record->id);
+ }
return $record;
}
@@ -234,7 +238,7 @@
if($tcn) {
$marcxml->documentElement->removeChild(
- $marcxml->documentElement->findnodes( '//datafield[@tag="035"]' )
+ $marcxml->documentElement->findnodes( '//marc:datafield[@tag="035"]' )
);
}
}
Modified: branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
===================================================================
--- branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm 2008-12-04 23:08:28 UTC (rev 11413)
+++ branches/rel_1_4/Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm 2008-12-04 23:10:18 UTC (rev 11414)
@@ -534,7 +534,10 @@
my $total = @$rec_ids;
my $count = 0;
my %queues;
+ my @ingest_queue;
+ my $ingest_ses = OpenSRF::AppSession->connect('open-ils.ingest');
+
for my $rec_id (@$rec_ids) {
my $overlay_target = $overlay_map->{$rec_id};
@@ -562,11 +565,11 @@
if(defined $overlay_target) {
$logger->info("vl: overlaying record $overlay_target");
$record = OpenILS::Application::Cat::BibCommon->biblio_record_replace_marc(
- $e, $overlay_target, $rec->marc); #$rec->bib_source
+ $e, $overlay_target, $rec->marc, undef, undef, undef, 1); #$rec->bib_source
} else {
$logger->info("vl: importing new record");
$record = OpenILS::Application::Cat::BibCommon->biblio_record_xml_import(
- $e, $rec->marc); #$rec->bib_source
+ $e, $rec->marc, undef, undef, undef, 1); #$rec->bib_source
}
if($U->event_code($record)) {
@@ -583,6 +586,9 @@
next;
}
+ $e->commit;
+ push @ingest_queue, { req => $ingest_ses->request('open-ils.ingest.full.biblio.record', $record->id), rec_id => $record->id };
+
} else { # authority
my $rec = $e->retrieve_vandelay_queued_authority_record($rec_id);
@@ -623,9 +629,11 @@
$e->rollback;
next;
}
+
+ $e->commit;
+ push @ingest_queue, { req => $ingest_ses->request('open-ils.ingest.full.authority.record', $record->id), rec_id => $record->id };
}
- $e->commit;
$conn->respond({total => $total, progress => $count, imported => $rec_id}) if (++$count % 10) == 0;
}
@@ -641,7 +649,7 @@
$queue->complete('t');
$e->update_vandelay_bib_queue($queue) or return $e->die_event;
$e->commit;
- return;
+ last
}
}
} else {
@@ -653,13 +661,20 @@
$queue->complete('t');
$e->update_vandelay_authority_queue($queue) or return $e->die_event;
$e->commit;
- return;
+ last
}
}
}
}
+ $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;
}
More information about the open-ils-commits
mailing list