From b5bded46f2fa4367dbfd40fd1a29262535896796 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sat, 3 Aug 2019 18:43:49 +0200 Subject: [PATCH] use update_columns to update affiliations. #324 --- app/models/doi.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/models/doi.rb b/app/models/doi.rb index 6e8988335..540c45803 100644 --- a/app/models/doi.rb +++ b/app/models/doi.rb @@ -642,17 +642,16 @@ def self.convert_affiliation_by_id(options={}) end if should_update - Doi.non_audited_columns = [:creators, :contributors] - doi.update_attributes(creators: creators, contributors: contributors) + doi.update_columns(creators: creators, contributors: contributors) count += 1 end end - logger.info "[Elasticsearch] Converted affiliations for #{count} DOIs with IDs #{id} - #{(id + 499)}." if count > 0 + logger.info "[MySQL] Converted affiliations for #{count} DOIs with IDs #{id} - #{(id + 499)}." if count > 0 count - rescue Elasticsearch::Transport::Transport::Errors::RequestEntityTooLarge, Faraday::ConnectionFailed, ActiveRecord::LockWaitTimeout => error - logger.info "[Elasticsearch] Error #{error.message} converting affiliations for DOIs with IDs #{id} - #{(id + 499)}." + rescue Faraday::ConnectionFailed, ActiveRecord::LockWaitTimeout => error + logger.info "[MySQL] Error #{error.message} converting affiliations for DOIs with IDs #{id} - #{(id + 499)}." end def doi=(value)