Skip to content

Commit

Permalink
Merge pull request #670 from datacite/fix_transfer_check
Browse files Browse the repository at this point in the history
Don't reindex on doi transfer if no db update
  • Loading branch information
richardhallett authored Nov 5, 2020
2 parents bf5a500 + 3eb2b1d commit 4200d78
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/jobs/transfer_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ def perform(doi_id, options={})
doi = Doi.where(doi: doi_id).first

if doi.present? && options[:client_target_id].present?
doi.update_attributes(datacentre: options[:client_target_id])
# Success starts as true because update_attributes only returns false on error.
success = true
success = doi.update_attributes(datacentre: options[:client_target_id])

doi.__elasticsearch__.index_document
if success
self.__elasticsearch__.index_document
end

Rails.logger.info "[Transfer] Transferred DOI #{doi.doi}."
elsif doi.present?
Expand Down

0 comments on commit 4200d78

Please sign in to comment.