<commit_before>class DepositJob < ActiveJob::Base
  queue_as :default

  def perform(deposit)
    ActiveRecord::Base.connection_pool.with_connection do
      deposit.start

      if deposit.message_action == 'delete'
        deposit.delete_works
        deposit.delete_events
        deposit.delete_contributors
        deposit.delete_publishers
      else
        deposit.update_works
        deposit.update_events
        deposit.update_contributors
        deposit.update_publishers
      end

      deposit.finish
    end
  end
end
<commit_msg>change deposit state to error if we raise an error. #453<commit_after>class DepositJob < ActiveJob::Base
  queue_as :default

  def perform(deposit)
    ActiveRecord::Base.connection_pool.with_connection do
      deposit.start

      if deposit.message_action == 'delete'
        deposit.delete_works
        deposit.delete_events
        deposit.delete_contributors
        deposit.delete_publishers
      else
        deposit.update_works
        deposit.update_events
        deposit.update_contributors
        deposit.update_publishers
      end

      deposit.finish
    end
  rescue => error
    deposit.error
    raise error
  end
end

{'fraction_non_alphanumeric': 0.051217464315701094, 'fraction_numerical': 0.0025188916876574307, 'mean_word_length': 2.5582089552238805, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6682536', 'n_tokens_mistral': 331, 'n_tokens_neox': 336, 'n_words': 69}