From 65e9ad83a85282617d38bed7d49d31575c171918 Mon Sep 17 00:00:00 2001 From: Cody Ross Date: Thu, 30 Mar 2023 08:20:58 -0400 Subject: [PATCH] Changes to improve performance and integrity of import_by_client --- app/models/datacite_doi.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/datacite_doi.rb b/app/models/datacite_doi.rb index 8c018925b..ab00cfe48 100644 --- a/app/models/datacite_doi.rb +++ b/app/models/datacite_doi.rb @@ -67,10 +67,9 @@ def self.import_by_client(client_id) end # import DOIs for client - Rails.logger.info "Started import of #{client.dois.length} DOIs for repository #{client_id}." + Rails.logger.info "Started import of #{client.dois.count} DOIs for repository #{client_id}." - # TODO remove query for type once STI is enabled - DataciteDoi.where(type: "DataciteDoi").where(datacentre: client.id). + DataciteDoi.where(datacentre: client.id). find_in_batches(batch_size: 50) do |dois| ids = dois.pluck(:id) DataciteDoiImportInBulkJob.perform_later(ids, index: self.active_index)