Skip to content

Commit

Permalink
handle indexing errors. #690
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Dec 24, 2020
1 parent c5ddd08 commit 87ae86b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/models/datacite_doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 = {})
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion app/models/other_doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {})
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 87ae86b

Please sign in to comment.