indexer batch size fixes
authorBill Erickson <berickxx@gmail.com>
Thu, 19 Sep 2019 17:10:23 +0000 (13:10 -0400)
committerBill Erickson <berickxx@gmail.com>
Tue, 22 Oct 2019 13:18:21 +0000 (09:18 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Elastic/Bib.pm
Open-ILS/src/perlmods/lib/OpenILS/Elastic/Bib/Search.pm

index 7d05749..c85811d 100644 (file)
@@ -25,8 +25,8 @@ use OpenILS::Utils::DateTime qw/interval_to_seconds/;
 use OpenILS::Elastic;
 use base qw/OpenILS::Elastic/;
 
-# number of bibs to index per batch.
-my $BIB_BATCH_SIZE = 500;
+# default number of bibs to index per batch.
+my $DEFAULT_BIB_BATCH_SIZE = 500;
 
 sub index {
     my $self = shift;
@@ -90,6 +90,7 @@ sub get_bib_ids {
     my $start_id = $state->{start_record} || 0;
     my $stop_id = $state->{stop_record};
     my $modified_since = $state->{modified_since};
+    my $batch_size = $state->{batch_size} || $DEFAULT_BIB_BATCH_SIZE;
 
     my ($select, $from, $where);
     if ($modified_since) {
@@ -111,7 +112,7 @@ sub get_bib_ids {
     # define the batches.
     my $order = "ORDER BY id";
 
-    my $sql = "$select $from $where $order LIMIT $BIB_BATCH_SIZE";
+    my $sql = "$select $from $where $order LIMIT $batch_size";
 
     my $ids = $self->get_db_rows($sql);
     return [ map {$_->{id}} @$ids ];
index 7c7a8ce..b4dc6c6 100644 (file)
@@ -30,9 +30,6 @@ use base qw/OpenILS::Elastic::Bib/;
 
 my $INDEX_NAME = 'bib-search';
 
-# number of bibs to index per batch.
-my $BIB_BATCH_SIZE = 500;
-
 my $BASE_INDEX_SETTINGS = {
     analysis => {
         analyzer => {