From 354f2cad4d7ee43e4a0d27008c10d0a79d4483a5 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 3 Jan 2021 11:57:03 +0100 Subject: [PATCH] reduce batch size. #690 --- app/models/datacite_doi.rb | 6 +++--- app/models/other_doi.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/datacite_doi.rb b/app/models/datacite_doi.rb index 518c9b4df..9636097a0 100644 --- a/app/models/datacite_doi.rb +++ b/app/models/datacite_doi.rb @@ -44,7 +44,7 @@ def self.import_by_ids(options = {}) # TODO remove query for type once STI is enabled # SQS message size limit is 256 kB, up to 2 GB with S3 DataciteDoi.where(type: "DataciteDoi").where(id: from_id..until_id). - find_in_batches(batch_size: 250) do |dois| + find_in_batches(batch_size: 200) do |dois| ids = dois.pluck(:id) DataciteDoiImportInBulkJob.perform_later(ids, index: index) count += ids.length @@ -71,7 +71,7 @@ def self.import_by_client(client_id) # TODO remove query for type once STI is enabled DataciteDoi.where(type: "DataciteDoi").where(datacentre: client.id). - find_in_batches(batch_size: 250) do |dois| + find_in_batches(batch_size: 200) do |dois| ids = dois.pluck(:id) DataciteDoiImportInBulkJob.perform_later(ids, index: self.active_index) end @@ -122,7 +122,7 @@ def self.import_in_bulk(ids, options = {}) count } DataCite DOIs." elsif count > 0 - Rails.logger.info "[Elasticsearch] Imported #{ + Rails.logger.debug "[Elasticsearch] Imported #{ count } DataCite DOIs." end diff --git a/app/models/other_doi.rb b/app/models/other_doi.rb index e6ae0796d..5de84ff93 100644 --- a/app/models/other_doi.rb +++ b/app/models/other_doi.rb @@ -95,7 +95,7 @@ def self.import_by_ids(options = {}) # TODO remove query for type once STI is enabled DataciteDoi.where(type: "OtherDoi").where(id: from_id..until_id). - find_in_batches(batch_size: 250) do |dois| + find_in_batches(batch_size: 200) do |dois| ids = dois.pluck(:id) OtherDoiImportInBulkJob.perform_later(ids, index: index) count += ids.length @@ -150,7 +150,7 @@ def self.import_in_bulk(ids, options = {}) count } Other DOIs." elsif count > 0 - Rails.logger.info "[Elasticsearch] Imported #{ + Rails.logger.debug "[Elasticsearch] Imported #{ count } Other DOIs." end