Skip to content

Commit

Permalink
improve logging for transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jun 2, 2020
1 parent a3089df commit 0f66dc7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/jobs/transfer_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def perform(doi_id, options={})

doi.__elasticsearch__.index_document

Rails.logger.warn "[Transfer] Transferred DOI #{doi.doi}."
Rails.logger.info "[Transfer] Transferred DOI #{doi.doi}."
elsif doi.present?
Rails.logger.error "[Transfer] Error transferring DOI " + doi_id + ": no target client"
else
Expand Down
5 changes: 3 additions & 2 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1027,12 +1027,13 @@ def self.import_by_client(client_id: nil)
end

count += dois.length
Rails.logger.info "[Elasticsearch] Imported #{count} DOIs for client #{client_id}."
end

if errors > 1
Rails.logger.error "[Elasticsearch] #{errors} errors importing #{count} DOIs for client #{client_id}."
elsif count > 0
Rails.logger.warn "[Elasticsearch] Imported #{count} DOIs for client #{client_id}."
Rails.logger.info "[Elasticsearch] Imported a total of #{count} DOIs for client #{client_id}."
end

count
Expand Down Expand Up @@ -1851,7 +1852,7 @@ def self.transfer(options={})

Rails.logger.info "[Transfer] Transferring #{response.results.results.length} DOIs starting with _id #{response.results.to_a.first[:_id]}."
cursor = response.results.to_a.last[:sort]

Rails.logger.info cursor
response.results.results.each do |d|
TransferJob.perform_later(d.doi, client_target_id: options[:client_target_id])
end
Expand Down

0 comments on commit 0f66dc7

Please sign in to comment.