Skip to content

Commit

Permalink
better logging of bulk doi transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Sep 18, 2018
1 parent 8395693 commit 3813b36
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/jobs/transfer_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ class TransferJob < ActiveJob::Base
queue_as :lupo_background

def perform(doi_id, options={})
logger = Logger.new(STDOUT)
doi = Doi.where(doi: doi_id).first

if doi.present?
doi.update_attributes(datacentre: options[:target_id])
else
logger = Logger.new(STDOUT)
if doi.blank?
logger.info "[Transfer] Error transferring DOI " + doi_id + ": not found"
elsif doi.update_attributes(datacentre: options[:target_id])
logger.info "[Transfer] Successfully transferred DOI " + doi_id
else
logger.info "[Transfer] Error transferring DOI " + doi_id + ": " + errors.inspect
end
end
end

0 comments on commit 3813b36

Please sign in to comment.