remove check for wait since it is defined by default now and add it to loading auths...
[migration-tools.git] / eg_staged_bib_overlay
index a517a6a..5ab56b3 100755 (executable)
@@ -33,7 +33,7 @@ my $dbpw;
 my $dbhost;
 my $batch;
 my $cutoff;
-my $wait = 1;
+my $wait = 0;
 my $output;
 my $link_skipped;
 
@@ -285,14 +285,13 @@ sub handle_stage_bibs {
             my $marc = MARC::Record->new_from_usmarc($_);
             my $bibid = $marc->subfield('901', 'c');
             if ($bibid !~ /^\d+$/) {
-                print STDERR "Record $i is suspect; skipping\n";
-                next;
+                die('Subfield 901$c is not numeric or missing.');
             }
             my $xml = OpenILS::Application::AppUtils->entityize($marc->as_xml_record());
             $ins->execute($xml, $bibid);
         };
         if ($@) {
-            print STDERR "Record $i is bad; skipping\n";
+            warn("Record $i is bad: $@; skipping.");
             next;
         }
     }
@@ -473,7 +472,7 @@ sub handle_stage_auths {
             $ins->execute($xml, $authid, $lccn, $cancelled_lccn, $xml);
         };
         if ($@) {
-            print STDERR "Record $i is bad; skipping\n";
+            warn("Record $i is bad: $@; skipping.");
             next;
         }
     }
@@ -595,6 +594,7 @@ sub handle_load_new_auths {
             )
         });
         $dbh->commit;
+        sleep $wait;
     }
 }