Z39 Batch ML
authorBill Erickson <berick@esilibrary.com>
Mon, 18 Feb 2013 22:00:23 +0000 (17:00 -0500)
committerBill Erickson <berick@esilibrary.com>
Mon, 18 Feb 2013 22:00:23 +0000 (17:00 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Search/Z3950.pm

index bf8c31b..0011dd9 100644 (file)
@@ -606,9 +606,11 @@ sub create_z39_bucket_queue {
 
 # sets the 901c value to the Z39 service and 
 # adds the record to the growing vandelay queue
+# returns the number of successfully queued records
 sub stamp_and_queue_results {
     my ($e, $queue, $service, $bre_id, $result) = @_;
     $logger->info("z3950 got bucket response for $bre_id");
+    my $qcount = 0;
 
     for my $rec (@{$result->{records}}) {
         $logger->info("z39: got result for $bre_id : $rec");
@@ -628,11 +630,14 @@ sub stamp_and_queue_results {
         $e->xact_begin;
         if ($e->create_vandelay_queued_bib_record($qrec)) {
             $e->commit;
+            $qcount++;
         } else {
             my $evt = $e->die_event;
             $logger->error("z39: unable to queue record: $evt");
         }
     }
+
+    return $qcount;
 }
 
 sub send_and_queue_bucket_searches {
@@ -665,7 +670,8 @@ sub send_and_queue_bucket_searches {
             $response->{search_complete}++;
             my $result = $resp->content or next;
             my $service = $result->{service};
-            stamp_and_queue_results($e, $queue, $service, $bre_id, $result);
+            $response->{queue_count} += 
+                stamp_and_queue_results($e, $queue, $service, $bre_id, $result);
         }
 
         $conn->respond($response);