From: Bill Erickson Date: Wed, 2 Mar 2016 15:57:56 +0000 (-0500) Subject: pingest --newest-first option X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=46b6c0d99feb90347fc669579f9b80e0265f4167;p=working%2Frandom.git pingest --newest-first option When set, --newest-first causes the script to processes records in descending order of edit_date, so that more recently edited/created records are ingested first. Signed-off-by: Bill Erickson --- diff --git a/pingest.pl b/pingest.pl old mode 100644 new mode 100755 index 4c8753c8a..d1bb30f7d --- a/pingest.pl +++ b/pingest.pl @@ -36,6 +36,7 @@ my $skip_facets; # Skip the facets reingest. my $start_id; # start processing at this bib ID. my $end_id; # stop processing when this bib ID is reached. my $max_duration; # max processing duration in seconds +my $newest_first; # Process records in descending order of edit_date my $help; # show help text GetOptions( @@ -47,6 +48,7 @@ GetOptions( 'skip-facets' => \$skip_facets, 'start-id=i' => \$start_id, 'end-id=i' => \$end_id, + 'newest-first' => \$newest_first, 'max-duration=i' => \$max_duration, 'help' => \$help ); @@ -75,6 +77,11 @@ sub help { --end-id Stop processing when this record ID is reached + --newest-first + During the initial bib record query, sort records by edit + date in descending order, so that records more recently + modified/created are processed before older records. + --max-duration Stop processing after this many total seconds have passed. @@ -96,12 +103,16 @@ if ($start_id && $end_id) { $where .= " AND id <= $end_id"; } +my $order_by = $newest_first ? + 'ORDER BY edit_date DESC, id DESC' : + 'ORDER BY id ASC'; + # "Gimme the keys! I'll drive!" my $q = <