<commit_before>module Gitlab
  module OptimisticLocking
    module_function

    def retry_lock(subject, retries = 100, &block)
      loop do
        begin
          ActiveRecord::Base.transaction do
            return block.call(subject)
          end
        rescue ActiveRecord::StaleObjectError
          retries -= 1
          raise unless retries >= 0
          subject.reload
        end
      end
    end

    alias :retry_optimistic_lock :retry_lock
  end
end<commit_msg>Fix Rubocop offense in OptimisticLocking module<commit_after>module Gitlab
  module OptimisticLocking
    module_function

    def retry_lock(subject, retries = 100, &block)
      loop do
        begin
          ActiveRecord::Base.transaction do
            return block.call(subject)
          end
        rescue ActiveRecord::StaleObjectError
          retries -= 1
          raise unless retries >= 0
          subject.reload
        end
      end
    end

    alias_method :retry_optimistic_lock, :retry_lock
  end
end
{'fraction_non_alphanumeric': 0.04890219560878244, 'fraction_numerical': 0.00998003992015968, 'mean_word_length': 2.057926829268293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '5264470', 'n_tokens_mistral': 278, 'n_tokens_neox': 269, 'n_words': 74}