<commit_before>require "active_support"
require "active_support/core_ext"
if ::RUBY_PLATFORM == "java"
  require 'march_hare'
else
  require "bunny"
end
require "lifeguard"
require "middleware"
require "thread"

require "action_subscriber/version"

require "action_subscriber/default_routing"
require "action_subscriber/dsl"
require "action_subscriber/configuration"
require "action_subscriber/middleware"
require "action_subscriber/rabbit_connection"
require "action_subscriber/subscribable"
require "action_subscriber/bunny/subscriber"
require "action_subscriber/march_hare/subscriber"
require "action_subscriber/threadpool"
require "action_subscriber/base"

module ActionSubscriber
  ##
  # Public Class Methods
  #

  # Loop over all subscribers and pull messages if there are
  # any waiting in the queue for us.
  #
  def self.auto_pop!
    return if ::ActionSubscriber::Threadpool.busy?
    ::ActionSubscriber::Base.inherited_classes.each do |klass|
      klass.auto_pop!
    end
  end

  # Loop over all subscribers and register each as
  # a subscriber.
  #
  def self.auto_subscribe!
    ::ActionSubscriber::Base.inherited_classes.each do |klass|
      klass.auto_subscribe!
    end
  end

  def self.configuration
    @configuration ||= ::ActionSubscriber::Configuration.new
  end

  def self.configure
    yield(configuration) if block_given?
  end

  def self.print_subscriptions
    ::ActionSubscriber::Base.print_subscriptions
  end

  def self.setup_queues!
    ::ActionSubscriber::Base.inherited_classes.each do |klass|
      klass.setup_queues!
    end
  end

  def self.start_queues
    ::ActionSubscriber::RabbitConnection.connect!
    setup_queues!
    print_subscriptions
  end

  def self.start_subscribers
    ::ActionSubscriber::RabbitConnection.connect!
    setup_queues!
    auto_subscribe!
    print_subscriptions
  end<commit_msg>replace connect! with subscriber_connection to fix a bug<commit_after>require "active_support"
require "active_support/core_ext"
if ::RUBY_PLATFORM == "java"
  require 'march_hare'
else
  require "bunny"
end
require "lifeguard"
require "middleware"
require "thread"

require "action_subscriber/version"

require "action_subscriber/default_routing"
require "action_subscriber/dsl"
require "action_subscriber/configuration"
require "action_subscriber/middleware"
require "action_subscriber/rabbit_connection"
require "action_subscriber/subscribable"
require "action_subscriber/bunny/subscriber"
require "action_subscriber/march_hare/subscriber"
require "action_subscriber/threadpool"
require "action_subscriber/base"

module ActionSubscriber
  ##
  # Public Class Methods
  #

  # Loop over all subscribers and pull messages if there are
  # any waiting in the queue for us.
  #
  def self.auto_pop!
    return if ::ActionSubscriber::Threadpool.busy?
    ::ActionSubscriber::Base.inherited_classes.each do |klass|
      klass.auto_pop!
    end
  end

  # Loop over all subscribers and register each as
  # a subscriber.
  #
  def self.auto_subscribe!
    ::ActionSubscriber::Base.inherited_classes.each do |klass|
      klass.auto_subscribe!
    end
  end

  def self.configuration
    @configuration ||= ::ActionSubscriber::Configuration.new
  end

  def self.configure
    yield(configuration) if block_given?
  end

  def self.print_subscriptions
    ::ActionSubscriber::Base.print_subscriptions
  end

  def self.setup_queues!
    ::ActionSubscriber::Base.inherited_classes.each do |klass|
      klass.setup_queues!
    end
  end

  def self.start_queues
    ::ActionSubscriber::RabbitConnection.subscriber_connection
    setup_queues!
    print_subscriptions
  end

  def self.start_subscribers
    ::ActionSubscriber::RabbitConnection.subscriber_connection
    setup_queues!
    auto_subscribe!
    print_subscriptions
  end
{'fraction_non_alphanumeric': 0.07895431740163718, 'fraction_numerical': 0.0, 'mean_word_length': 4.722054380664653, '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': '2939092', 'n_tokens_mistral': 1198, 'n_tokens_neox': 1166, 'n_words': 262}