Log last processed record collab/berick/pingest
authorBill Erickson <berickxx@gmail.com>
Wed, 13 Apr 2016 14:29:04 +0000 (10:29 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 13 Apr 2016 14:29:07 +0000 (10:29 -0400)
With each batch completed log message, log the ID of the last record
processed.  Useful for multiple runs of the script.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
pingest.pl

index ee25bd4..1db34f5 100755 (executable)
@@ -229,12 +229,14 @@ browse_ingest(@blist) unless ($skip_browse);
 
 # We loop until we have processed all of the batches stored in @lol
 # or the maximum processing duration has been reached.
+my $last_record;
 while ($count < $lists) {
     my $duration_expired = duration_expired();
 
     if (scalar(@lol) && scalar(@running) < $max_child && !$duration_expired) {
         # Reuse $records for the lulz.
         $records = shift(@lol);
+        $last_record = $records->[-1];
         if ($skip_search && $skip_facets && $skip_attrs) {
             $count++;
         } else {
@@ -245,15 +247,14 @@ while ($count < $lists) {
         if (grep {$_ == $pid} @running) {
             @running = grep {$_ != $pid} @running;
             $count++;
-            announce('DEBUG', 
-                "reingest() processed $count of $lists batches");
+            announce('DEBUG', "reingest() processed $count of ".
+                "$lists batches; last record = $last_record");
         }
     }
 
     if ($duration_expired && scalar(@running) == 0) {
-        my $last_rec = pop(@$records);
         announce('INFO', 
-            "reingest() stopping on record $last_rec on max duration");
+            "reingest() stopping on $last_record at max duration");
         exit(0);
     }
 }
@@ -289,8 +290,8 @@ sub browse_ingest {
                 last;
             }
 
-            announce('DEBUG', 
-                "browse_ingest() processed $count of $total records")
+            announce('DEBUG', "browse_ingest() processed $count ".
+                "of $total records; last record = $_") 
                 if ++$count % $batch_size == 0;
         }
         $dbh->disconnect();