<commit_before>module Concerns::SkippableAdvisoryLock
  attr_reader :skip_locking

  def with_advisory_lock_unless_skip_locking(name, &block)
    if skip_locking
      yield
    else
      ActiveRecord::Base.with_advisory_lock(name, &block)
    end
  end
end<commit_msg>Take a transaction-level advisory lock, to prevent a potential race condition in signups<commit_after>module Concerns::SkippableAdvisoryLock
  attr_reader :skip_locking

  def with_advisory_lock_unless_skip_locking(name, &block)
    if skip_locking
      yield
    else
      ActiveRecord::Base.with_advisory_lock(name, transaction: true, &block)
    end
  end
end
{'fraction_non_alphanumeric': 0.05993690851735016, 'fraction_numerical': 0.0, 'mean_word_length': 4.7727272727272725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6881176', 'n_tokens_mistral': 216, 'n_tokens_neox': 196, 'n_words': 45}