<commit_before>class AmqpManager
  include Celluloid

  TOPICS = [:ahn, :push]


  TOPICS.each { |name|
    class_eval %Q"
      def #{name}_channel
        @#{name}_channel ||= connection.create_channel
      end
    "

    class_eval %Q"
      def #{name}_xchange
        @#{name}_xchange ||= #{name}_channel.topic('voice.#{name}', auto_delete: false)
      end
    "

    class_eval %Q"
      def #{name}_queue
        @#{name}_queue ||= #{name}_channel.queue('voice.#{name}', auto_delete: false)
      end
    "
  }


  def ahn_publish(payload)
    data = Marshal.dump(payload)
    ahn_xchange.publish(data, routing_key: 'voice.ahn')
  end<commit_msg>rescue Bunny::ConnectionClosedError<commit_after>class AmqpManager
  include Celluloid

  TOPICS = [:ahn, :push]


  TOPICS.each { |name|
    class_eval %Q"
      def #{name}_channel
        @#{name}_channel ||= connection.create_channel
      end
    "

    class_eval %Q"
      def #{name}_xchange
        @#{name}_xchange ||= #{name}_channel.topic('voice.#{name}', auto_delete: false)
      end
    "

    class_eval %Q"
      def #{name}_queue
        @#{name}_queue ||= #{name}_channel.queue('voice.#{name}', auto_delete: false)
      end
    "
  }


  def ahn_publish(payload)
    data = Marshal.dump(payload)
    ahn_xchange.publish(data, routing_key: 'voice.ahn')
  rescue Bunny::ConnectionClosedError
    # This happens during shutdowns.
  end
{'fraction_non_alphanumeric': 0.14072494669509594, 'fraction_numerical': 0.0, 'mean_word_length': 2.9329608938547485, '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': '7444233', 'n_tokens_mistral': 489, 'n_tokens_neox': 478, 'n_words': 90}