diff --git a/Gemfile.lock b/Gemfile.lock index 2ea9e71cc..7c6c56ba5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -87,8 +87,6 @@ GEM attr_extras (7.1.0) base64 (0.2.0) bcrypt_pbkdf (1.1.1) - bcrypt_pbkdf (1.1.1-arm64-darwin) - bcrypt_pbkdf (1.1.1-x86_64-darwin) benchmark (0.4.0) bigdecimal (3.1.9) bootsnap (1.18.4) diff --git a/app/services/indexer.rb b/app/services/indexer.rb index be7b59500..a748bd8cc 100644 --- a/app/services/indexer.rb +++ b/app/services/indexer.rb @@ -6,11 +6,15 @@ class Indexer def self.reindex(cocina_object:, trace_id: nil) return unless Settings.solr.enabled + trace_id ||= trace_id_for(druid: cocina_object.externalIdentifier) solr_doc = Indexing::Builders::DocumentBuilder.for( model: cocina_object, - trace_id: trace_id || trace_id_for(druid: cocina_object.externalIdentifier) + trace_id: ).to_solr solr.add(solr_doc) + # This logging is to assist with https://github.com/sul-dlss/dor-services-app/issues/5231 + # It is capturing that a Solr document is being committed and the order relative to other commits. + Rails.logger.info("[Indexing] Committing #{cocina_object.externalIdentifier} with trace_id=#{trace_id}") solr.commit end @@ -39,7 +43,7 @@ def self.solr def self.trace_id_for(druid:) source = Kernel.caller_locations(2, 1).first.to_s.delete_prefix("#{Rails.root}/") # rubocop:disable Rails/FilePath SecureRandom.uuid.tap do |trace_id| - Rails.logger.info("Reindexing #{druid} from #{source} with trace_id=#{trace_id}") + Rails.logger.info("[Indexing] Reindexing #{druid} from #{source} with trace_id=#{trace_id}") end end end