<commit_before>require 'singleton'

module Hearst
  class Dispatcher
    include Singleton

    def initialize
      connection.start
    end

    def connection
      @connection ||= Bunny.new(host)
    end

    def host
      ENV['AMQP_HOST']
    end

    def channel
      @channel ||= connection.create_channel
    end

    def exchange
      @exchange ||= channel.topic(exchange_name)
    end

    def exchange_name
      ENV['EXCHANGE_NAME']<commit_msg>Ensure exchanges we're broadcasting on are durable and not auto deleted<commit_after>require 'singleton'

module Hearst
  class Dispatcher
    include Singleton

    def initialize
      connection.start
    end

    def connection
      @connection ||= Bunny.new(host)
    end

    def host
      ENV['AMQP_HOST']
    end

    def channel
      @channel ||= connection.create_channel
    end

    def exchange
      @exchange ||= channel.topic(exchange_name, durable: true, auto_delete: false)
    end

    def exchange_name
      ENV['EXCHANGE_NAME']
{'fraction_non_alphanumeric': 0.0702274975272008, 'fraction_numerical': 0.0, 'mean_word_length': 2.601423487544484, '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': '5076071', 'n_tokens_mistral': 312, 'n_tokens_neox': 285, 'n_words': 81}