diff --git a/app/models/datacite_doi.rb b/app/models/datacite_doi.rb index eacc5b5e1..84ecd3142 100644 --- a/app/models/datacite_doi.rb +++ b/app/models/datacite_doi.rb @@ -54,6 +54,8 @@ def self.import_by_ids(options = {}) logger.info "Queued importing for DataCite DOIs with IDs #{from_id}-#{until_id}." count + rescue Aws::SQS::Errors::RequestEntityTooLarge => e + Rails.logger.error "[Elasticsearch] Error #{e.class}: #{mapped_dois.bytesize} bytes" end def self.import_by_client(client_id) @@ -67,6 +69,8 @@ def self.import_by_client(client_id) end DataciteDoiImportInBulkJob.perform_later(mapped_dois, index: self.active_index) end + rescue Aws::SQS::Errors::RequestEntityTooLarge => e + Rails.logger.error "[Elasticsearch] Error #{e.class}: #{mapped_dois.bytesize} bytes" end def self.import_in_bulk(dois, options = {}) @@ -118,10 +122,11 @@ def self.import_in_bulk(dois, options = {}) count rescue Elasticsearch::Transport::Transport::Errors::RequestEntityTooLarge, + Aws::SQS::Errors::RequestEntityTooLarge, Faraday::ConnectionFailed, ActiveRecord::LockWaitTimeout => e - Rails.logger.error "[Elasticsearch] Error #{ + Rails.logger.error "[Elasticsearch] Error #{e.class} with message #{ e.message } importing DataCite DOIs." end diff --git a/app/models/other_doi.rb b/app/models/other_doi.rb index 7accc4b71..5f7a0c6ce 100644 --- a/app/models/other_doi.rb +++ b/app/models/other_doi.rb @@ -105,6 +105,8 @@ def self.import_by_ids(options = {}) logger.info "Queued importing for Other DOIs with IDs #{from_id}-#{until_id}." count + rescue Aws::SQS::Errors::RequestEntityTooLarge => e + Rails.logger.error "[Elasticsearch] Error #{e.class}: #{mapped_dois.bytesize} bytes" end def self.import_in_bulk(dois, options = {}) @@ -156,10 +158,11 @@ def self.import_in_bulk(dois, options = {}) count rescue Elasticsearch::Transport::Transport::Errors::RequestEntityTooLarge, + Aws::SQS::Errors::RequestEntityTooLarge, Faraday::ConnectionFailed, ActiveRecord::LockWaitTimeout => e - Rails.logger.error "[Elasticsearch] Error #{ + Rails.logger.error "[Elasticsearch] Error #{class} with message #{ e.message } importing Other DOIs." end