protecting against insert/update race condition
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 17 Aug 2006 20:31:11 +0000 (20:31 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 17 Aug 2006 20:31:11 +0000 (20:31 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@5573 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm

index 9de9eab..f273597 100644 (file)
@@ -227,10 +227,13 @@ sub rw_biblio_ingest_single_record {
        my $rec = shift;
 
        OpenILS::Application::Ingest->post_init();
-       my $r = OpenSRF::AppSession
-                       ->create('open-ils.cstore')
-                       ->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $rec )
-                       ->gather(1);
+       my $cstore = OpenSRF::AppSession->connect( 'open-ils.cstore' );
+       $cstore->request('open-ils.cstore.transaction.begin')->gather(1);
+
+       my $r = $cstore->request( 'open-ils.cstore.direct.biblio.record_entry.retrieve' => $rec )->gather(1);
+
+       $cstore->request('open-ils.cstore.transaction.rollback')->gather(1);
+       $cstore->disconnect;
 
        return undef unless ($r and @$r);